$pageSize = "10";
$hostname = "127.0.0.1"; // Usually localhost.
$username = "estarburst"; // If you have no username, leave this space empty.
$password = "cove2002"; // The same applies here.
$usertable = "products"; // This is the table you made.
$dbName = "estarburst"; // This is the main database you connect to.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
// Request the text of all the product names
if ($search == "all") {
$search = "%";
}
$result = mysql_query("SELECT * FROM $usertable WHERE Type LIKE '%$search%' ORDER BY `Name` ASC");
$noRows = mysql_num_rows($result);
// find number of page
$noPage = $noRows / $pageSize;
if ($noPage - round($noPage) > 0) {
$noPage = round($noPage) + 1;
} else {
$noPage = round($noPage);
}
if (!$result) {
echo("Error performing query: " .
mysql_error() . "
");
exit();
}
?>
 | Products & Services |
|
|
 |
|
 |
// Display the name of each product in a paragraph
if ($noRows == 0) {
echo('No records found, please try again');
} else {
// move to right place
for ($i = 1 ; $i < $current; $i++) {
$product = mysql_fetch_array($result);
}
// get data for output
for ($i = $current ; $i < $pageSize+$current ; $i++ ) {
if ($i != $noRows + 1 ) {
$product = mysql_fetch_array($result);
?>
| echo ($i); ?>
|
echo(' ');
?>
|
Name
: echo ($product["Name"]); ?>
|
| |
Manufacturer
:
echo ($product["Manufacturer"]); ?>
Price :
$
echo ($product["Price"]); ?>
echo('More Info ....'); ?>
|
Category :
echo ($product["Type"]); ?>
Condition :
echo ($product["Condition"]); ?>
|
|
} else {
break;
} // end if for each rows
} // end for
} // end if
?>
More
products:
for ($i = 0 ; $i < $noPage ; $i++) {
$j = ($i * $pageSize) +1 ;
$k = $i +1 ;
echo(' '.$k.' ');
}
?>
|
|
|

 |