Jump to content

warning problem


jagguy

Recommended Posts

I get a warning problem and i can't see anythong wrong with the code. Also this fails on my livesite but not on my pc.

 

 

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 204 in /home/jagguy/public_html/zen/includes/languages/english/html_includes/custom/define_myspecials.php on line 77

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 204 in /home/jagguy/public_html/zen/includes/languages/english/html_includes/custom/define_myspecials.php on line 78

 

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 204 in /home/jagguy/public_html/zen/includes/languages/english/html_includes/custom/define_myspecials.php on line 79

 

  $sql2="select   a.categories_id  ,parent_id ,categories_name
          from   products_to_categories a ,categories b ,categories_description c where
         a.categories_id= b.categories_id  and  b.categories_status=1 and c.categories_id= b.categories_id
          and a.products_id='$pid'";
    $result2 = mysql_query($sql2)    or die("Invalid query: " . mysql_error());

    $parid= mysql_result($result2, 0, 'parent_id'); //line77
    $catid=  mysql_result($result2, 0, 'categories_id');//line 78 etc
    $catname=  mysql_result($result2, 0, 'categories_name');

Link to comment
https://forums.phpfreaks.com/topic/46121-warning-problem/
Share on other sites

i dont know much about the _result, but look at actually getting the array mysql_fetch_array, and looping through that

 

i think thats the more popular way of doing it, and i know whats how id do it, but i dont know for certain, i dont use _result.

 

 

good luck

Link to comment
https://forums.phpfreaks.com/topic/46121-warning-problem/#findComment-224127
Share on other sites

  $sql2="select   a.categories_id  ,parent_id ,categories_name
          from   products_to_categories a ,categories b ,categories_description c where
         a.categories_id= b.categories_id  and  b.categories_status=1 and c.categories_id= b.categories_id
          and a.products_id='$pid'";
    $result2 = mysql_query($sql2)    or die("Invalid query: " . mysql_error());

    $parid= mysql_result($result2, 1, 'parent_id'); //line77
    $catid=  mysql_result($result2, 1, 'categories_id');//line 78 etc
    $catname=  mysql_result($result2, 1, 'categories_name');

 

Try that. If not that than this will work:

 

  $sql2="select   a.categories_id  ,parent_id ,categories_name
          from   products_to_categories a ,categories b ,categories_description c where
         a.categories_id= b.categories_id  and  b.categories_status=1 and c.categories_id= b.categories_id
          and a.products_id='$pid'";
    $result2 = mysql_query($sql2)    or die("Invalid query: " . mysql_error());

$row = mysql_fetch_array($result2);
$parid = $row['parent_id'];
$catid = $row['categories_id'];
$catname = $row['categories_name'];

 

Now this will work for 1 row, which it seems like you are doing if you want more than one than you would need to put that into a while loop.

 

Hope that works out for ya.

Link to comment
https://forums.phpfreaks.com/topic/46121-warning-problem/#findComment-224231
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.