gathos Posted August 14, 2008 Share Posted August 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119749-please-help-followed-tutorial-but-db-not-working/ Share on other sites More sharing options...
Barand Posted August 14, 2008 Share Posted August 14, 2008 What is the name of your table? If it is "table" then change it, as table is a SQL reserved word. Quote Link to comment https://forums.phpfreaks.com/topic/119749-please-help-followed-tutorial-but-db-not-working/#findComment-616967 Share on other sites More sharing options...
gathos Posted August 14, 2008 Author Share Posted August 14, 2008 thanks barand, it works now it was named table- i wasn't thinking. i appreciate your help. Quote Link to comment https://forums.phpfreaks.com/topic/119749-please-help-followed-tutorial-but-db-not-working/#findComment-616982 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.