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
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');
} 

Link to comment
Share on other sites

@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().

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.