I’m working on a comment system and the last thing I have to do is read the database. Here is the code:
<?php
//conection
mysql_connect("localhost","root","") or die(mysql_error());
echo "Connected!";
mysql_select_db("ycomment") or die(mysql_error());
echo "DBSelected!";
//the real stuff. oh yeah.
$show = mysql_query("SELECT * FROM comments");
echo "Query made!";
$result = mysql_query($show) or die(mysql_error());
while($show = mysql_fetch_array($result)) {
echo "While loop?";
$name = $show['name'];
$commment = $row['comment'];
echo "Name: $name";
echo "Comment: $comment";
}
?>
This is what I’m getting:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Resource id #6’ at line 1.