damian0612 Posted January 28, 2010 Share Posted January 28, 2010 I have used the basic pagination tutorial from phpfreaks to create page links at the bottom of the page and it works fine when you want to browse all the table info. However, If I only want to browse the info where the category column is equal to say 'birthday' then it doesn't seem to facilitate this. Is there a work around for this? So the code: $sql = "SELECT * FROM cardlist LIMIT $offset, $rowsperpage"; works fine, but when I change it to this: $sql = "SELECT * FROM cardlist WHERE category = '$id' LIMIT $offset, $rowsperpage"; The results are blank. I attach the full code. Any help would be appreciated. Thanks [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/190102-pagination/ Share on other sites More sharing options...
ChemicalBliss Posted January 28, 2010 Share Posted January 28, 2010 I havnt looked at the attachment to be perfectly honest i cba with downloading an attachment, i would reccomend posting it inline (i know you tried to make ur post neat and tidy, but sometimes content is key ). Though i am a realy lazy monkey . Anyway, You have either; 1) a Typo (Column name misspelled or incorrect Case, or column data mispelled or incorrect Case). 2) SQL Error, Either the data doesnt exist, or MySQL cannot evaluate a result set because there is an error in your SQL. To fix/debug: 1) echo $id before the query, to make sure it is what it's supposed to be. 2) echo the query to make sure its exactly what you expect/want. 3) Try the query in PHP My Admin (a Free MySQL Administration Interface). 4) Make sure the result set comes back clean and how you expect. print_r(mysql_fetch_assoc($result)); should suffice. 5) Make sure you are handling the data correctly, make sure you havnt changed the display code or anything else that could affect it. Good Luck, -CB- Quote Link to comment https://forums.phpfreaks.com/topic/190102-pagination/#findComment-1003002 Share on other sites More sharing options...
damian0612 Posted January 28, 2010 Author Share Posted January 28, 2010 Thanks for the advice, went over my code & found I hadn't added this: $id = $_GET["id"]; also need to pass the id into the links again for the next pages, great help, cheers Quote Link to comment https://forums.phpfreaks.com/topic/190102-pagination/#findComment-1003019 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.