sam06 Posted January 21, 2009 Share Posted January 21, 2009 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 More sharing options...
jjacquay712 Posted January 21, 2009 Share Posted January 21, 2009 $check = mysql_num_rows(mysql_query("SELECT uniqueid FROM tomhar WHERE ip='$ip' ")); if( $check > 0 ) { //do whatever } Link to comment https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/#findComment-742374 Share on other sites More sharing options...
flyhoney Posted January 21, 2009 Share Posted January 21, 2009 $query = "SELECT uniqueid FROM tomhar WHERE ip='$ip'"; $result = mysql_query($query); if (mysql_num_rows($result) == 1) { $result = mysql_result($result, 0, 'uniqueid'); } Link to comment https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/#findComment-742387 Share on other sites More sharing options...
sam06 Posted January 21, 2009 Author Share Posted January 21, 2009 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 https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/#findComment-742400 Share on other sites More sharing options...
flyhoney Posted January 21, 2009 Share Posted January 21, 2009 That definitely works but I would say it's silly to run the query twice! Link to comment https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/#findComment-742565 Share on other sites More sharing options...
DarkWater Posted January 21, 2009 Share Posted January 21, 2009 @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 https://forums.phpfreaks.com/topic/141800-solved-unable-to-jump-to-row-0/#findComment-742654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.