Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/Test.php on line 22
This is the error I get when just doing a basic php while loop here is the code below. The Query works great in phpmyadmin sql tab, $runItem does not bring up an error. Just keep getting an error for the while loop.
<?php
//dbconn
require_once("dbconn.php");
?>
<html>
<body>
<?php
// query the item table
$query = "SELECT itemID, typeID, typeName, graphicID
FROM test.Item
ORDER BY typeName";
$runItem = mysql_query($query) or die ('Error: '.mysql_error());
while($item = mysql_fetch_array($query))
{
$itemID = $item["itemID"];
$typeID = $item["typeID"];
$typeName = $item["typeName"];
$graphicID = $item["graphicID"];
// display row
echo "$itemID - $typeID / $typeName * $graphicID<BR>";
}
?>
</body>
</html>