PHP & MySql Blog Comment
Posted: Fri Jan 16, 2009 3:07 pm
Hello Helpful Developers,
I' am trying to make a blog and so far so good. The only issue I am having has to do with the comments. I do not know how to combine the comments table to the blog table. So I want specific comments to show up on specific blog posts. Here is my query to select the blog info.
So if i have a form on the same page that is for comments and I insert them into the database how do I add them to the corresponding blog id. Here is my comments table.
table:
comments
fields:
id, int(5), auto increment
name, varchar (255)
comment, text
date, datetime
Any help is much appreciated.
I' am trying to make a blog and so far so good. The only issue I am having has to do with the comments. I do not know how to combine the comments table to the blog table. So I want specific comments to show up on specific blog posts. Here is my query to select the blog info.
Code: Select all
<?
$id=$_GET['id'];
$info=mysql_query("select title,author,entry,date_format(date , '%M %e, %Y') date from blog where id='$id' limit 1");
$inforow=mysql_fetch_array($info);
$title = $inforow[0];
$author = $inforow[1];
$entry = $inforow[2];
$date = $inforow[3];
?>
table:
comments
fields:
id, int(5), auto increment
name, varchar (255)
comment, text
date, datetime
Any help is much appreciated.