Jump to content

please help followed tutorial but DB not working


gathos

Recommended Posts

Ok here is my problem every time i load my page database.php I see

 

Connection to the server was successful!

Database was selected!

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/user/public_html/typh.ca/database.php on line 6

 

this is my code

<?php   mysql_connect("localhost", "****", "****") or exit(mysql_error());   
echo "Connection to the server was successful!<br/>";    
mysql_select_db("database") or die(mysql_error());   
echo "Database was selected!<br/>";
$result = mysql_query("SELECT * FROM table");    
while ($row = mysql_fetch_assoc($result)) {
    echo $row["id"];
    echo $row["name"];
    echo $row["city"];
echo $row["age"];
}
?>

 

please help me, this database thing is driving me bonkers, i cannot find the error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.