View Full Version : MYSQL error

01-24-2007, 04:15 AM

I am getting this error. Could you help plzz? thanks

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Online Services\Apache2\htdocs\searchexample1.php on line 49

line49: while ($row = mysql_fetch_array($result))



$sql = ("SELECT * FROM ..... WHERE .....");

$conn = mysql_connect("","") OR DIE (mysql_error());
mysql_select_db("cartonlots", $conn) OR DIE (mysql_error());

$result = mysql_query ($sql, $conn);
echo "<TABLE BORDER=2>";

while ($row = mysql_fetch_array($result))
echo "<TR><TD>".$row["image_id"]."<TD>".$row["smdescription"]; }

echo "</TABLE>";


01-24-2007, 05:10 AM
Check your query to see if it failed and if it did print mysql_error().

01-24-2007, 06:03 AM
Is not error there sorry it says warning.

01-24-2007, 06:27 AM
Your query is failing but you didn't bother to check to see if it is failing, you're just going right in to trying to use the query's resource, which isn't a valid resource, because the query failed, so you are getting a warning about the resource not being valid, which is being caused by your query failing, which you are not checking on.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum