Hi.
First off, I'm new to PHP. So you will have to be real specific with your answers.
I'm trying to create a comments section under my news articles and I'm having a real hard time with it. At first I was wanting to make it so that a new comments table is created for every news post, but I was told to just make it one table.
I really don't know what I'm doing wrong here. I get an error message saying "Query was empty".
News Article (Works):
mysql_select_db($database_mgslog, $mgslog);
$query_news = sprintf("SELECT * FROM newsarticle WHERE id = %s", GetSQLValueString($colname_news, "int"));
$news = mysql_query($query_news, $mgslog) or die(mysql_error());
$row_news = mysql_fetch_assoc($news);
$totalRows_news = mysql_num_rows($news);
Comment Section (Doesn't Work):
mysql_select_db($database_mgslog, $mgslog);
$query_news = ("SELECT * FROM newscomments WHERE nid = id");
$news = mysql_query($query_newscomments, $mgslog) or die(mysql_error());
$row_news = mysql_fetch_assoc($news);
$totalRows_news = mysql_num_rows($news);
Form Field (For the comment section that doesn't work):
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" />
<p>Name : <input type="text" name="name" length="25" maxlength="50" value="<?php if(isset($_POST['name'])) echo $_POST['name'];?>" /></p>
<p>Comment : <textarea columns="6" rows="6" name="comment"><?php if(isset($_POST['comment'])) echo $_POST['comment'];?></textarea></p>
<p><input type="submit" name="submit" value="Submit Comment" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
News Table
[img]http://img827.imageshack.us/img827/3512/newsx.gif[/img]
Comments Table
[img]http://img59.imageshack.us/img59/8632/commentsv.gif[/img]