Jump to content

unable to jump to row 0 MySQL


vyb3

Recommended Posts

I've got a very strange error on my site (www.vyb3.co.uk)

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 44 in /home/fhlinux159/v/vyb3.co.uk/user/htdocs/vyb308/news/index.php on line 46

####@@@**split**@@@###Please enter a name.####@@@**split**@@@###

 

The error appears in a completely different place on my site to where I installed the script thats resulted in this error, Its a vbulletin login script to allow users to be able to login to the site on the homepage as well as in the forums (because im going to password protect some pages)

 

But yeah the code for this login box is:

 

This code is displayed at the top of my page before the <html> tag

<?php
$curdir = getcwd ();
chdir('../forum');
require_once('../forum/global.php');
chdir ($curdir);
?>

 

Then this code is placed where I want my login box to be.

<?PHP 
		$forumpath = "../forum";
		// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {



// +++++++++++++++++++++++++++++++++++++++++
// As Logged in display welcome back message
// +++++++++++++++++++++++++++++++++++++++++
echo "Welcome Back, <b>";
echo $vbulletin->userinfo['username'];
echo " !</b><br />";

// As were logged in display logout link
echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&logouthash=$logouthash";
echo $vbulletin->userinfo['logouthash'];
echo "\">";
echo "<font size=\"1\" face=\"verdana\">Log Out</font></a><br />";

// Display last visit time and date
echo "You last visited: $pmbox[lastvisitdate] at $pmbox[lastvisittime]";
echo "<br />";

// Display PM Details and generate link to PM box
echo "<a href=\"".$forumpath."private.php?$session[sessionurl] \">Private Messages: </a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]";
echo "<br />";

} else { 

include("login_vb.php");
}
		?>

 

Then this is the code for login_vb.php

<form action="../forum/login.php?do=login" method="post" onSubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
  	  <input type="hidden" name="do" value="login" />
  	  <input type="hidden" name="url" value="http://www.vyb3.co.uk/vyb308/index.php?vyb3=main" />
  	  <input type="hidden" name="vb_login_md5password" />
  	  <input type="hidden" name="vb_login_md5password_utf" />
  	  <input type="hidden" name="s" value="$session[sessionhash]" />
  	  <label>Username:<input name="vb_login_username" type="text" class="bginput" id="login" accesskey="u" tabindex="1" size="12"/>
  	  </label>
  	  <label><br>
  	  Password:
  <input name="vb_login_password" type="password" class="bginput" id="password" tabindex="1" size="12" />
  </label>
      <label><br>
      Remember me?
  <input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" /></label>
      <br>
      <input name="submit" type="submit" id="submit" tabindex="1" value="Login" accesskey="s" class="button" />
</form>

 

And the error displays on a completely different part of the site...

Link to comment
Share on other sites

Hey there.

Im not sure, but I have used this before.

http://forums.mysql.com/read.php?52,142673,200941#msg-200941

 

In your script, wherever you run the mysql_result(); try doing mysql_num_rows() before using mysql_result() and see if you get anything back.

 

$sql = "Whatever";

$query = mysql_query($sql);

$numRows = mysql_num_rows($query);

echo $numRows;

 

Try that and tell us whet you get. If it's 0, you have no records.

Link to comment
Share on other sites

Ok i have figured it out the problem is coming from the index file of my news script...

 

$delimiter = '####@@@**split**@@@###';

 

I found that piece of code in there.... Still I don't know what to change to make this error go away, it has also caused my news categories search function to malfunction....

 

This is really doing my head in!

Link to comment
Share on other sites

$query = mysql_query($sql);
$allowcomments = mysql_result($query,0);
echo $delimiter;
					$message = slash2($_POST['message']);
					$message = str_replace($delimiter ,"",$message);
					$name = slash2($_POST['name']);
					$name = str_replace($delimiter,"",$name);
					$email = slash2($_POST['email']);
					$email = str_replace($delimiter,"",$email);						
                 	if(!$name){
                 		echo "Please enter a name.";
                 	}elseif(!$message){
                 		echo "Please enter a message.";
                 		
                 	}else{
                 	 if($allowcomments == "1" || $allowcomments == "2"){
						$sql2 = "SELECT * FROM $newsusers WHERE user = '". $name . "'";
						$query2 = mysql_query($sql2);
						$ex = mysql_num_rows($query2);
						if(time() - $_SESSION['lastmsg'] <= $spamtime){
							$spammsg = str_replace("{timeleft}",($spamtime - (time() - $_SESSION['lastmsg'])),$spammsg);
							echo $spammsg;

						}else{
							$user = slash2($_POST['name']);
							$user = str_replace($delimiter ,"",$user);
							$message = slash2($_POST['message']);
							$message = str_replace($delimiter ,"",$message);
							$email = slash2($_POST['email']);
							$email = str_replace($delimiter ,"",$email);
							$timestamp = time();
							$ip = $_SERVER['REMOTE_ADDR'];
							$pid = slash2($id);
							$all = mysql_fetch_array($query2);
							if($allowcomments == "1"){
								$approved = '1';
							}elseif($allowcomments == "2"){
								$approved = '0';
							}
							$sql = "INSERT INTO $newscomments (user,email,message,timestamp,approved,ip,pid) VALUES ('$user','$email','$message','$timestamp','$approved','$ip','$pid')";																				
							if($ex == 1){								
								if($_SESSION['name'] == $all['user']){								 	
								 	$_SESSION['lastmsg'] = time();
								 	$query = mysql_query($sql) or die(mysql_error());
								 	if($allowcomments == "1"){
									 	echo $commentmsg;
									}elseif($allowcomments == "2"){
										echo $commentapprovemsg;
									}

								}else{
								    echo "Choose another name.";
								    
								}	
							}else{
									$_SESSION['lastmsg'] = time();
							 	    $query = mysql_query($sql) or die(mysql_error());
								 	if($allowcomments == "1"){
									 	echo $commentmsg;
									}elseif($allowcomments == "2"){
										echo $commentapprovemsg;
									}
							 	    
							}
						}
					  }else{
					  	#incase anyone tries adding comments to posts which have comments disabled
					   	echo "Nice try";
					  }
                 	}




}
echo $delimiter;

} 

 

Line 46 which the error message displays is: $allowcomments = mysql_result($query,0);

 

So any ideas peeps? i'm trying....

Link to comment
Share on other sites

I tried that man

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 25 in /home/fhlinux159/v/vyb3.co.uk/user/htdocs/vyb308/news/index.php on line 46
####@@@**split**@@@###Please enter a name.####@@@**split**@@@### 

 

this is real baffling me u no

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.