Jump to content

pagination


damian0612

Recommended Posts

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]

Link to comment
Share on other sites

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 :P). Though i am a realy lazy monkey :P.

 

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-

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.