Echo database (db)

Hello World!

I’ve been writing a website in php and I am making a commenting system. Everything works fine, I just need to be able to read the database. Here’s my script:

mysql_connect("localhost","root","");
echo "Connected!"; //testing purposes only
mysql_select_db("ycomment");
echo "DBSelected!"; //testing purposes only
$result = mysql_query("SELECT * FROM comments");
echo "Variable created!"; //testing purposes only
while($row = mysql_fetch_array($result)) {
	echo "Name: " . $row['name'] . "<br />";
	echo "Comment: " . $row['comment'] . "<br />";
}

Maybe you should put the eeror your getting or what the problem you are having is ?
put a error message in or die()

I’m not sure what the problem is anymore, it had something to do with using the wrong user and some blah blah simple mistake. ;D

Sponsor our Newsletter | Privacy Policy | Terms of Service