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.
Warning: mysql_result(): Unable to jump to row 0 ....
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
justravis
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 16, 2002 3:18 am
- Location: San Diego, CA
- Contact:
$org & $web are submitted through a form.
There is one record in the org table:
id name url
1 justravis justravis.com
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();
}
}
?>you are sure that $query is correct?
the other option for that is to use mysql_fetch_array
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]
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();
}
}
?>[edit] since the error you are getting implies that your query returns no results, if you still have trouble try: echo mysql_error();
[/edit]