Supplied argument is not a valid in MySQL result resource

by Nirmala 2008-11-19 10:11:36

Hi....
You need to check for errors after submitting a query and before you attempt to use the returned result identifier. The proper way to do this is with code similar to the following:
<?php

$result = mysql_query("SELECT * FROM tables_priv");
if (!$result) {
echo mysql_error();
exit;
}
?>
or
<?php

$result = mysql_query("SELECT * FROM tables_priv")
or die("Bad query: " . mysql_error());
?>

Tagged in:

1590
like
1
dislike
0
mail
flag

You must LOGIN to add comments