This is a rather interesting problem, I recently used a while() function to display some data from a mysql database. Here's the code:
$getitemlist = mysql_query("SELECT * FROM itemdb WHERE 1");
echo "<table cellspacing=3 cellpadding=3 border=0>";
echo "<tr><td><b>Item Number</td><td><b>Item Code</td><td><b>Composition</td><td><b>Specification</td><td><b>Height</td><td><b>Width</td><td><b>Item Type</td><td><b>Image File</td><td><b>Edit</td><td><b>Delete</td></tr>";
while($getitem = mysql_fetch_array($getitemlist)) {
echo "<tr><td>$getitem[itemnum]</td><td>$getitem[fcode]</td><td>$getitem[fcomp]</td><td>$getitem[fspec]</td><td>$getitem[fheight]</td><td>$getitem[fwidth]</td><td>$getitem[ftype]</td><td>$getitem[ifile]</td><td>[<a href=admin.php?view=edititem&enum=$getitem[itemnum]>edit</a>]</td><td>[<a href=admin.php?view=deleteitem&delnum=$getitem[itemnum]>delete</a>]</td></tr>";
}
echo "</table>";
When I go to the page that this code is supposed to run on, I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/waynetex/public_html/admin/viewitem.php on line 6
The funny thing about this is that it works perfectly on my computer using PHPTriad, but I only get this problem once it's running on my web server. Anyone have any ideas as to what's wrong?