I have a pagination script working good but i recently encountered a problem. Im making a database for garments and i have the garments split up into Coats, Jackets, Strollers etc.... I set up a query
Code: Select all
// Define the number of results per page
$max_results = 6;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
$sql = mysql_query("SELECT * FROM garment WHERE tog='coat' LIMIT $from, $max_results");
I got the script online and taylored it to my needs. I only want to show 6 items per page and everything is going great. I currently have 7 items in my database. 5 are coats, and 2 are jackets. Whats happening is the next and previous paginated links are showing up on all the pages. I realized that the query is working correctly and doing what i asked it to do, show 6 items and then go to the next page, however i want to make it so it shows 6 jackets and go to the next page, not show 2 jackets and go to the next page. I dont want to make a different table for each type of garment. How can i fix the query to make it work the way i want to.
Thanks for all your replys
-soia