Jump to content

[SOLVED] Unable to jump to row 0


sam06

Recommended Posts

Hi there-

Any ideas how to remove the error? It's a query to check if the records in there. It all seems to work for me, apart from throwing up that error. Ideally I just want to stop it showing it, as it all works fine.

$check = mysql_query("SELECT uniqueid FROM tomhar WHERE ip='$ip' ");
if($check) {
$result = mysql_result ($check, 0, 'uniqueid');
}

Originally there was no IF, but I put that in to try and stop the error from coming up. Unfortunetly it didn't. The error code is saying line 19, which is the $result= line.

 

Cheers,

Sam

Link to comment
https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/
Share on other sites

Thanks very much both of you

In the end I went for

$check = mysql_num_rows(mysql_query("SELECT uniqueid FROM tomhar WHERE ip='$ip' "));
if( $check > 0 ) {
$check5 = mysql_query("SELECT uniqueid FROM tomhar WHERE ip='$ip' ");
$result = mysql_result ($check5, 0, 'uniqueid');
} 

@sam06: Use flyhoney's method.  In the one you have now, you're doing the query twice.  That wastes resources and it absolutely pointless.

 

EDIT: Also, mysql_result() is pretty slow compared to the other fetching functions.  Use one of those as opposed to mysql_result().

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.