Unable to jump to row 0

Started on the old forum in March 2013 · view the original in the archive · old links redirect here

13 replies · 692 views · started 13 years ago · 2 min read

5 participants
tzapone Junior · 30 posts #1

Hello guys, i have a problem on my site.

if($komm_list)
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
$ank=get_user($post['id_user']);
$kim=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);
$kum=mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);

$kom=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='$kum' LIMIT 1"),0);
////
//$q=mysql_query("SELECT * FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
////
$kem=$kim-1;
if($kim==1){
echo "<div class='p_t'>\n";
echo "<img src='status/suka.gif'> <a href='/info.php?id=$kum'>$kom</a> like statuse.";
echo "</div>";
}
elseif($kim>=2){
echo "<div class='p_t'>\n";
echo "<img src='status/suka.gif'> <a href='/info.php?id=$kum'>$kom</a> and <a href='status/like_all.php?id=".$statuse['id']."'>$kem altii</a> like statuse.";
echo "</div>";
}
echo "</div>";
while ($post = mysql_fetch_assoc($q))
{
//$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$ank=get_user($post['id_user']);

echo "<div class='p_t'>\n";
//echo "<a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a>\n";
user($ank['id']);
//echo "<a href='info.php?id=$ank[id]'><b>".status($ank['id'])."<span style=\"color:$ank[ncolor]\">$ank[nick]</span></b></a>";
//echo "".medal($ank['id'])." ".online($ank['id'])." ";
echo "<span style=\"color:$ank[mcolor]\">";
echo "".output_text($post['msg'])."";
echo "</span>\n";
echo "<br /><font class='time'>".waktu($post['time'])."</font></span>\n";

if (isset($user) && ($user['level']>=4) || isset($user) && ($user['id'] == $statuse['id_user']))
echo "<a href='?id=".intval($_GET['id'])."&del=$post[id]'> Delete</a><br />\n";
echo "</div>";
}

if ($k_page>1)str("?id=".intval($_GET['id']).'&',$k_page,$page);
//Form komentar

echo"<div class='p_t'>\n";
if (isset($user))

{echo "<form method=\"post\" name='message' action=\"?id=".intval($_GET['id'])."&page=$page\">\n";
if ($set['web'] && is_file(H.'style/themes/'.$set['set_them'].'/altername_post_form.php'))
include_once H.'style/themes/'.$set['set_them'].'/altername_post_form.php';
else
/*echo "<div>";
echo "<form method=\"post\" name='message' action=\"?\">\n";
echo "<table cellspacing=\"0\" cellpadding=\"0\" class=\"comboInput\"><tr><td class=\"inputCell\">";
echo "Add a p_t";
echo "<br />\n<textarea name=\"msg\" rows=\"3\" cols=\"13\"></textarea></td><td>\n";
echo "<input class=\"btn btnC\" value=\"Comment\" type=\"submit\"/></td></tr></table></div>\n";
echo "</form></div>\n";*/
echo "<div id=\"body\">Adaugi comentariu?<form method=\"post\" id=\"composer_form\" name=\"message\" action=\"?\"><table class=\"comboInput\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td class=\"inputCell\"><textarea class=\"input composerInput\" name=\"msg\" rows=\"2\" cols=\"15\"></textarea></td><td><input value=\"Comment\" class=\"btn btnC\" type=\"submit\"></td></tr></tbody></table></div></form></div>";
}
}
else
{
echo"<a href='komm.php?id=$statuse[id]'>»Comment</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '$statuse[id]'"),0).")<br/>";
}

the error is here but i can't fix it. $kum=mysql_result(mysql_query("SELECT id_user FROM statuse_like WHERE id_statuse = '".intval($_GET['id'])."'"),0);

$kom=mysql_result(mysql_query("SELECT nick FROM user WHERE id='$kum' LIMIT 1"),0);

and this is the message: *Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 78 in /home/wapcomun/public_html/sper/list.php on line 214

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 79 in /home/wapcomun/public_html/sper/list.php on line 216*

something else Fellow · 2,296 posts #2

what happens when you remove the ,0 from both lines?

arnage Lead · 811 posts #3

This intval($_GET['id'] sets the first query to 0, so try changing it to:

$id = isset($_GET['id']) ? abs(intval($_GET['id'])) : ''; // This should be used for every global var

$kum=mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '".$id."'"),0);

$kom=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='$kum' LIMIT 1"),0);
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
tzapone Junior · 30 posts #4

something else wrote: what happens when you remove the ,0 from both lines?

Warning: Wrong parameter count for mysql_result() in /home/wapcomun/public_html/list.php on line 217

Warning: Wrong parameter count for mysql_result() in /home/wapcomun/public_html/list.php on line 219

Added after 5 minutes:

arnage wrote: This intval($_GET['id'] sets the first query to 0, so try changing it to:

$id = isset($_GET['id']) ? abs(intval($_GET['id'])) : ''; // This should be used for every global var

$kum=mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '".$id."'"),0);

$kom=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='$kum' LIMIT 1"),0);

i have the same error. Another thing is that when i give a like or somebody like the status , the error don;t appear anymore. Error appear when nobody like the status and appear only to staff memebers 🙁

subzero Super moderator Fellow · 3,954 posts #5

You need to end tag the 0

Like

,0);

To

,'0');

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

arnage Lead · 811 posts #6

tzapone wrote: Warning: Wrong parameter count for mysql_result() in /home/wapcomun/public_html/list.php on line 217

Warning: Wrong parameter count for mysql_result() in /home/wapcomun/public_html/list.php on line 219

Added after 5 minutes:

i have the same error. Another thing is that when i give a like or somebody like the status , the error don;t appear anymore. Error appear when nobody like the status and appear only to staff memebers :(

You need to change it everywhere, and this things $statuse[id] like this $statuse['id'] or $statuse["id"].

And set sql rows if its NOT NULL with DEFAULT ''

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
arnage Lead · 811 posts #8

I have no other idea. 🙁

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
subzero Super moderator Fellow · 3,954 posts #9

Something might be stupid thing like

(*) FROM statuse_komm WHERE id_statuse = '".intval($_GET['id'])."'"),0);

Do this

$to-get-id = intval($_GET['id']);

(*) FROM statuse_komm WHERE id_statuse = '".$to-get-id."'"),0);

Might be the problem..

Self closing to nothing.

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

kevk3v Senior · 332 posts #10

subzero wrote: Do this

$to-get-id = intval($_GET['id']);

(*) FROM statuse_komm WHERE id_statuse = '".$to-get-id."'"),0);

Might be the problem..

Self closing to nothing.

$to-get-id is an invalid variable should be something like $to_get_id

The reason is the minus sign (-) because its a php operator.

Added after 12 minutes:

This sounds like the no data is being returned, try this

<?php

$id = isset($_GET['id']) ? abs(intval($_GET['id'])) : ''; // arnage 
$sql = "SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '$id'";
$query = mysql_query($sql) or die ("Could not get data because ".mysql_error());
$num_rows = mysql_num_rows($query);

if ($num_rows>0) {
    echo "rows found";
    } else {
    echo "no rows found";
}

if(empty(intval($_GET['id']))
{
echo ', the problem is $_GET["id"]...';
}

///tell us the output of this...

?>

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

arnage Lead · 811 posts #11

Globals must be checked is isset for example with

$id = isset($_GET['id']) ? abs(intval($_GET['id'])) : ''; // right way (with abs() added)

... otherwise it returns 0 like this,

$id = intval($_GET['id']); // wrong way and Notice undefinied index

... but he says he tried to change that in all lines and still getting the same error.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
kevk3v Senior · 332 posts #12

I still think no data is being returned, he said "Another thing is that when i give a like or somebody like the status , the error don;t appear anymore. Error appear when nobody like the status"

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

tzapone Junior · 30 posts #13
if($komm_list)
{
    $k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);
    $k_page=k_page($k_post,$set['p_str']);
    $page=page($k_page);
    $start=$set['p_str']*$page-$set['p_str'];
    $q=mysql_query("SELECT * FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
    if(mysql_num_rows(mysql_query("SELECT * FROM `statuse_like` WHERE `id_statuse`='".intval($_GET['id'])."'"))!=0)
    {
        $kim=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);
        $kum=mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);

        $kom=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='$kum' LIMIT 1"),0);
    }
    else
        $kim=0;

    //$q=mysql_query("SELECT * FROM `statuse_like` WHERE `id_statuse` = '".intval($_GET['id'])."' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
    ////
    $kem=$kim-1;
    if($kim==0){
        echo "<div class='p_t'>\n";
        echo "Nobody like the status.";
        echo "</div>";
    }
    elseif($kim==1){
        echo "<div class='p_t'>\n";
        echo "<img src='status/suka.gif'> <a href='/info.php?id=$kum'>$kom</a> like status.";
        echo "</div>";
    }
    elseif($kim>=2){
        echo "<div class='p_t'>\n";
        echo "<img src='status/suka.gif'> <a href='/info.php?id=$kum'>$kom</a> and <a href='status/like_all.php?id=".$statuse['id']."'>$kem altii</a> like status.";
        echo "</div>";
    }
    echo "</div>"; 

i put this code and no more errors 😀 thanks for the help.

arnage Lead · 811 posts #14

Cool, if that works for you ok... Set error_reporting(E_ALL); to see the errors.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close