Page 1 of 1
Warning: mysql_result(): Unable to jump to row 0 ....
Posted: Mon Jul 21, 2003 3:11 am
by justravis
Getting this error:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 4
What is the usual cause of this?
Thanks for your time.
Posted: Mon Jul 21, 2003 4:28 am
by twigletmac
justravis wrote:What is the usual cause of this?
There is no row 0?
Could we see your code in order to be able to help you better.
Mac
Posted: Mon Jul 21, 2003 12:20 pm
by justravis
$org & $web are submitted through a form.
There is one record in the org table:
id name url
1 justravis justravis.com
Code: Select all
<?php
#Returns 1 piece of data from database. Ex: 1 cell, count, max.
function cell($query)
{
$result=mysql_query($query);
#mysql_result($result, row, col): returns 1 cell, specifying col optional.
$cell=mysql_result($result, 0);
return $cell;
}
if($org || $web)
{
$org_id=cell("SELECT id FROM org WHERE name='$org'");
if($org_id && $web)
{
mysql_query("UPDATE org SET url=$web WHERE id=$org_id");
}
else
{
mysql_query("INSERT INTO org (name, url,) VALUES ('$org', '$web')");
$org_id=mysql_insert_id();
}
}
?>
Posted: Mon Jul 21, 2003 1:48 pm
by Coco
you are sure that $query is correct?
the other option for that is to use mysql_fetch_array
Code: Select all
<?php
function cell($query)
{
$result=mysql_query($query);
if($cell=mysql_fetch_array($result));
return $cell['item'];
else
return 'err';
}
if($org || $web)
{
$org_id=cell("SELECT id FROM org WHERE name='$org'");
if($org_id && $web && ($org_id!='err'))
{
mysql_query("UPDATE org SET url=$web WHERE id=$org_id");
}
else
{
mysql_query("INSERT INTO org (name, url,) VALUES ('$org', '$web')");
$org_id=mysql_insert_id();
}
}
?>
excluding syntax, that
should work
[edit] since the error you are getting implies that your query returns no results, if you still have trouble try: echo mysql_error();

[/edit]