...

View Full Version : Unable to jump row 0



TrainReq
06-03-2007, 10:41 PM
I am getting the following error:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 2 in /home/content/i/n/n/**/html/tracker/connect.php on line 35

Here is my coding from line 34 on down.




$result = mysql_query($sql);
$uid = mysql_result($result, 0, "id");
$sql="INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('NULL','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
//This code shows up no matter what, no point in having it.
//echo "Hello there!";
mysql_close($con);

Fumigator
06-03-2007, 10:46 PM
That error most likely indicates your query (the one we can't see) did not return any rows. Use mysql_num_rows() to see if this is indeed the case.

TrainReq
06-03-2007, 10:50 PM
[code]
INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('NULL','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')
[/php]

That is my query.. i have never messed with mysql_num_rows, i have no idea how to work that.

twomt
06-03-2007, 10:51 PM
I am getting the following error:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 2 in /home/content/i/n/n/innovator22/html/tracker/connect.php on line 35

Here is my coding from line 34 on down.




$result = mysql_query($sql);
$uid = mysql_result($result, 0, "id");
$sql="INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('NULL','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
//This code shows up no matter what, no point in having it.
//echo "Hello there!";
mysql_close($con);


My first question would be what the value of $sql is that you use in line 34 :

$result = mysql_query($sql);

Is there a specific reason why you would want to use mysql_result() as it is not the best option (for performance reason alone) to use, perhaps something llike mysql_fetch_array() or mysql_fetch_object() might be more suitable.

Have you tried to execute the $sql statement directly into the database to see if you get a response or if perhaps $sql has an error in it?

TrainReq
06-03-2007, 10:55 PM
the value of $sql is



INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('NULL','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')

twomt
06-03-2007, 10:55 PM
[code]
INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('NULL','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')
[/php]

That is my query.. i have never messed with mysql_num_rows, i have no idea how to work that.

Just a guess, the value of RID you set to 'NULL', if this is your primary key it is probably auto increment and I would this expect to be '' then instead or leave it out completely.


INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')

twomt
06-03-2007, 11:01 PM
OK, this might be far fetched... did you define $sql before you executed it in line 34 or is it only defined afterwards in line 36?

TrainReq
06-03-2007, 11:02 PM
i defined on line 36 ... i went


$sql="INSERT INTO hits
(RID,uid,username,Current,Referrer,Name,Picture,Login,Cookie,Date,logins,email,ip)
VALUES
('','$uid','$HTTP_GET_VARS[g]','$HTTP_GET_VARS[url]','$HTTP_GET_VARS[referrer]','$HTTP_GET_VARS[name]','$HTTP_GET_VARS[pic]','$HTTP_GET_VARS[login]','$HTTP_GET_VARS[cookie]','$date_posted','$HTTP_GET_VARS[logins]','$HTTP_GET_VARS[email]','$_SERVER[REMOTE_ADDR]')";
on line 36-39

but still did not fix the prob.

twomt
06-03-2007, 11:04 PM
maybe you want to move the definition of $sql 2 lines up before the execution of $result = mysql_query($sql);

TrainReq
06-03-2007, 11:09 PM
Now i am getting a whole new error

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/content/i/n/n/**/html/tracker/connect.php on line 40

Here is the stuff on line 39 on down


$result = mysql_query($sql);
$uid = mysql_result($result, 0, "id");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
//This code shows up no matter what, no point in having it.
//echo "Hello there!";
mysql_close($con);

twomt
06-03-2007, 11:15 PM
Well, can you at least check on the db if the insert was done so we know that part works?

also you use "id" in the mysql_result statement and I didnt see this in your insert query. Should this be uid or RID?

TrainReq
06-03-2007, 11:19 PM
the incert was not done, and I am not sure what RID does, but it should be uid if incerting into users table or id if incerting into the hits table

twomt
06-03-2007, 11:26 PM
I guess what you need to try and figure out first is why the insert was not done. Can you execute it manually using phpMyAdmin, mysql or something similar?

TrainReq
06-03-2007, 11:34 PM
listen.. if you have AOL instant messanger of yahoo messanger or MSN .. message me your details... i will give you full coding as well as access to the server so you can look more into it.. i will be willing to pay if needed.

TrainReq
06-03-2007, 11:54 PM
can anyone else help me out?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum