Click to See Complete Forum and Search --> : "Unable to jump to row 0" error
ssffcc
05-14-2006, 03:51 PM
hi all, i got this message:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 6 in c:\inetpub\wwwroot\DreamWeaverSites\webadmin\wa.php on line 2296
for these lines of code:
$sql11="delete from Booking where Booking_Id='$Booking_Id'";
$result11=mysql_query($sql11);
the code actually works (i.e. the deletion function works properly), but throws above error, please help get rid of it
Sheldon
05-14-2006, 04:14 PM
have you connected to the database?
try this
$sql11="delete from Booking where Booking_Id='".$Booking_Id."'";
$result11=mysql_query($sql11) or die ("Sorry..." . mysql_error());
Also what is this? "sql11" & "result11"? you should try naming your variables to something that matched your query to make it easier to understand at a later date.
NogDog
05-14-2006, 04:58 PM
The error message is complaining about a call to mysql_result(), not mysql_query(). If you have a mysql_result() calling the result of your delete query, that's probably what's raising the error, since a delete query will not return any result rows that the mysql_result() could reference.
ssffcc
05-15-2006, 07:40 AM
thx all for your help, so is there another function that i can use to execute the delete query?
chazzy
05-15-2006, 07:51 AM
thx all for your help, so is there another function that i can use to execute the delete query?
You need to post more of your code. The error you're getting is because the type of result you have after a delete query can't be used with mysql_result - there is nothing returned by the delete except the number of rows affected (on success) or an error (on failure)
this is a delete
$result = mysql_query("DELETE FROM TABLE WHERE ...");
$numrows=mysql_affected_rows();
if($numrows > 0){
echo "I deleted ".$numrows." rows<br />\n";
}
else{
echo "I failed to delete from your table because: ".mysql_error()." <br />\n";
}
ssffcc
05-15-2006, 07:54 AM
sheldon, thx for your code, it got rid of the error message. and also thx for your suggestion, i will use more meaningful names in the future :)