Jump to content
MakeWebGames

PHP Error Message


Monkey644

Recommended Posts

Hey everyone,

I am getting the following error message: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 17 in /home/a4767764/public_html/class/class_db_mysql.php on line 94

Only on my index.php page, all other pages are fine.

Any advice on this?

Cheers

Link to comment
Share on other sites

You have to check whether there are any results before attempting to fetch a result (which is what mysql_result() does).

To do this in MCCodes v2:

 

if(!$result || $db->num_rows($result) == 0) {
   //Means $result is empty
}

 

After something like this, you can then fetch the result appropriately.

~G7470

PS: FYI, the mysql_ extension has been deprecated. You should covert to mysqli_ sometime soon.

Link to comment
Share on other sites

You have to check whether there are any results before attempting to fetch a result (which is what mysql_result() does).

To do this in MCCodes v2:

 

if(!$result || $db->num_rows($result) == 0) {
   //Means $result is empty
}

 

After something like this, you can then fetch the result appropriately.

~G7470

PS: FYI, the mysql_ extension has been deprecated. You should covert to mysqli_ sometime soon.

The snippet of code that is causing this error is:

 if(!$result) { $result=$this->result; }
   return mysql_result($result, 0, 0);
 }

 

Any advice?

Link to comment
Share on other sites

The snippet of code that is causing this error is:
 if(!$result) { $result=$this->result; }
   return mysql_result($result, 0, 0);
 }

 

Any advice?

The code inside of the class_db_mysql.php file is fine (as I know that's where this came from).

The problem is how you're calling the fetch_single() function. You have to check to see whether a row exists in the query result BEFORE attempting to fetch anything; otherwise, you're going to continue running into this problem.

~G7470

Link to comment
Share on other sites

The snippet of code that is causing this error is:
 if(!$result) { $result=$this->result; }
   return mysql_result($result, 0, 0);
 }

 

Any advice?

Incorrect, that code is fine.

Edit index.php, find any instance of

$db->fetch_single

, paste that and the surrounding five lines (from both sides) here.

Link to comment
Share on other sites

Incorrect, that code is fine.

Edit index.php, find any instance of

$db->fetch_single

, paste that and the surrounding five lines (from both sides) here.

The function is:

function fetch_single($result=0)
 {
   if(!$result) { $result=$this->result; }
   return mysql_result($result, 0, 0);
 }

 

There is nothing containing fetch_single in the index.php and I have found this is happening on loggedin.php

If it's any help, this has only appeared after I installed Sniko's Advanced Property Modification.

Link to comment
Share on other sites

You most likely have a bad query.

Look at line 17 in your index file, of i remember correctly he uses a lot of functions for this mod. Then look for that function in global funcs or his own includes that came with the mod and post both the function and definition of the function

Link to comment
Share on other sites

I have found the following within the property mod globals, which is an included file.

 

function get_house_name($id) {
global $db;
$get = $db->query("SELECT `name` FROM `property_mod` WHERE `id`={$id}");
return $db->fetch_single($get);	
}

function get_house_name_by_row($row) {
global $db;
$get = $db->query("SELECT `name` FROM `property_mod` WHERE `id` IN (SELECT `houseid` FROM `properties_mod_user` WHERE `id`={$row})");
return $db->fetch_single($get);	
}

 

This is out of the global func file.

}
function get_rank($stat, $mykey)
{
global $db;
global $ir,$userid,$c;
$q=$db->query("SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.$mykey > $stat AND us.userid != $userid AND u.user_level != 0") ;
return $db->fetch_single($q)+1;
}
function item_add($user, $itemid, $qty, $notid=0)
{
 global $db;
 if($notid > 0)
 {
Edited by Monkey644
Link to comment
Share on other sites

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.   Paste as plain text instead

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