Jump to content

How to get page identifer?


chandler

Recommended Posts

Ok it's getting into the db now, but its not printing to the page,

 

db looks like this

Full Texts comment_id comment date_added page_id name

Edit Delete 1   2011-07-20 18:47:56 0 Stephen Downs

Edit Delete 2 test 0000-00-00 00:00:00 0 john doe

Edit Delete 3 test 2 0000-00-00 00:00:00 0 john doe

Link to comment
Share on other sites

I tried changing that to, still nothing echoing

 

$result = mysql_query("SELECT `comment`, name, comment_id, date_added
FROM comments c
JOIN pages p ON p.page_id = c.page_id
WHERE c.page_id = 0 ORDER BY c.date_added")
or die(mysql_error()); 

 

 

Link to comment
Share on other sites

My assumption is pages table has nothing with ID 0. You'll need to update the database to have the id's as 1. Not trying to be rude here, but this is some basic troubleshooting. You need to look at the database via PHPMyAdmin and try running the queries and see what they return. If they don't return, you need to modify your query or look at your data to understand why it is not returning anything.

Link to comment
Share on other sites

Yes, when adding the new comments you have to fetch the table id from somewhere (maybe link or something). This will be the id of the page the comment is related to. And when inserting new comment you insert this page id also in the comments table.

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.