Jump to content

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result


intrigue

Recommended Posts

Please can anyone tell me why i get this error with the following script
[b]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\autoFinder\admin\functions\authenticate.php on line 62[/b]

[pre]
if (isset($id))
{
echo("hey");
$search = "SELECT * FROM ct_clients WHERE accountHash = '".$id."'";
$result = mysql_query($search) or die(mysql_error());
if ($row = mysql_fetch_array($result))
{
$search2 = "UPDATE ct_clients SET password = '".md5($password)."' WHERE accountHash = '".$id."' LIMIT 1";
$result2 = mysql_query($search2) or die(mysql_error()); [b]// LINE62[/b]
if ($row2 = mysql_fetch_array($result2))
{
echo("Password updated<br />");
echo("Email sent.<br />");
}
}
}
[/pre]
an UPDATE query does not return any rows, therefore you cannot run mysql_fetch_array() on its resource ID.  if you want to find out how many rows were affected in the last update, delete, etc. use mysql_affected_rows().

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.