Categorized | Affiliate Marketing 101

Show 10 Products Per Page? More Than 10 Auto Create New Page To Display Next 10?php?

Ok hey guys, thanks for reading this post. now what I am trying to do is simply displaying 10 products from the table and if more than 10 products are shown it will then automatically add a new page with like.. a different ID in the url? Well anything really as long as it will generate the pages dynamically. Below is my current coding.
$data = mysql_query(“SELECT * FROM products;”) or die(mysql_error());
$id = mysql_query(“SELECT ID FROM products;”) or die (mysql_error());
while($info = mysql_fetch_array( $data ))
{
echo ‘

‘;
echo “

“;
}
echo “

“;
echo ‘<a href="?page=products&uid='.$info['ID'].'…
Echo "
“;
echo “
“;
echo “

“;
Echo “Name: “.$info[‘name’] . “
“;
Echo “Price: “.$info[‘price’] . ”

“;
echo “

“;
Echo “Please click the image for further info.


“;
echo “


?>
As the coding shows, it is simply displaying the entire table in the PHP, however the problem is that the table will simply continue for ever, until their is no more products!! If you don’t know how to automatically generate a new page then would it be a good idea to show row 1-10, 11-20, 21-30 in different pages. If so how would this be done? Oops, I forgot to mention that the user will access the next list of products, E.G 11-20 by clicking the next page button.
Is it possible to use a get function to change the ID of the url when next page is clicked? then it will show the 11-20 results depending on the URL? eg products&id=2 therefore showing the next list of products? I am pretty confused hehe!:)
Thanks, your knowledge is appreciated!:)

Leave a Reply

Your email address will not be published. Required fields are marked *

Archives

Powered by Yahoo! Answers