note 6968 deleted from mysql_result by ronabop
| From: | ronabop@php.net | Date: | Thu, 17 Aug 2000 08:36:31 +0000 |
| Subject: | note 6968 deleted from mysql_result by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2023@lists.php.net to get a copy of this message | ||
I have the following code:
$sql = "SELECT student_id, name FROM students WHERE name LIKE '$Name'";
$overwrite = mysql_query($sql,$db);
echo "overwrite is $overwrite<BR>";
if (!$overwrite) {
$status=1;
break;
}
$id_exists = mysql_result($overwrite,0,"student_id");
$name_exists = mysql_result($overwrite,0,"name");
If $name_exists is not null, I want to UPDATE instead of INSERTing stuff in the db. It works fine,
however i keep getting the warning
"Warning: Unable to jump to row 0 on MySQL result index 2 in..." when the query
doesn't return anything.
How can i get rid of the warnings? it seems that mysql_result doesn't return an empty row when
there aren't any results, but an undefined object...however $overwrite=2 not 0 ....
Any help would be appreciated.