Jump to content

SIMPLE CODE - CANT SEE PROBLEM


Peterod

Recommended Posts

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.

:shrug:

 

<?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.

 

Link to comment
https://forums.phpfreaks.com/topic/211559-simple-code-cant-see-problem/
Share on other sites

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.