hi to all!
i want to search the products from my site. with the following address as the page load the specific category products. for example, [U][B]category_id=5
when page is opened it find the query based on query string and also want to show 10 products per page it works fine but when products exeeds the limit (10), it also creats the total page but when i goes to next page it set the error message. can any body lead me to the right way that what should i do with that script for creating the pages. thanks
here is the page link that presents in the address bar of the browser when page is loaded.
[url]http://localhost/hardware/hardwares.php?category_id=5
also script i use is as follows:
<?php
$sql = mysql_query(“SELECT * FROM `products
$numrows = mysql_num_rows($sql);
print “In this category products are : “.$numrows;
if( empty($page) ) {
$page = 0;
}
$limit = 10;
$products = mysql_query(“SELECT * FROM `products` WHERE “.$_SERVER[‘QUERY_STRING’].” ORDER BY `product_name` ASC LIMIT $page, $limit “);
while ( $res = mysql_fetch_array($products) ) {
$pages = intval( $numrows / $limit );
if ( $numrows % $limit ) {
$pages++;
}
for ( $i=1; $i <= $pages; $i++ ) {
$newpage = $limit*($i-1);
$next = “<a href=$PHP_SELF?page=$newpage>Page $i</a> n”;
}
?>