Peterod Posted August 23, 2010 Share Posted August 23, 2010 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\parkhall\quantities.php on line 21 This is the error message. This is the code. simple array query to display contents of table and I cant see where i have made the mistake. hopefully someone can help. <?php mysql_connect ("localhost", "******", "*****") or die ('I cannot connect to the database becuase: ' . mysql_error()); mysql_select_db ("matquant"); $query = mysql_query("SELECT * FROM quantities"); while ($row = mysql_fetch_array($query)) { //line referred to in error message echo "<br /> ID: " .$row ['id']. " material : " .$row ['material']. "quantity:" .$row['quantity']. "<br />";} ?> Please point out the probably glaring error. I'm relatively new to this and I am really not finding php easy to learn. Quote Link to comment https://forums.phpfreaks.com/topic/211559-simple-code-cant-see-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 23, 2010 Share Posted August 23, 2010 The error message means that your query failed due to an error. Echo mysql_error(); on the next line after the line with your mysql_query() statement to find out why the query failed. Quote Link to comment https://forums.phpfreaks.com/topic/211559-simple-code-cant-see-problem/#findComment-1102906 Share on other sites More sharing options...
Peterod Posted August 23, 2010 Author Share Posted August 23, 2010 didnt think of that. thanks a bunch. Solved Quote Link to comment https://forums.phpfreaks.com/topic/211559-simple-code-cant-see-problem/#findComment-1102921 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.