Jump to content

MYSQL Fetch Problem


Ugat

Recommended Posts

Hi Guys,

 

Can I ask question regarding mysql fetch function doenst not working I received this kind of error:

 

 

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\Auction\Virtuosity(Online Auction)\admin\changetree.php5 on line 14

Here is my code:

<?php
session_start();

include  'config.php5';
  $i=$_POST['i'];
$mid = $_SESSION["id"];

  
  $str="";
    
     $str.='<ul id="browser" class="filetree">';
     $qry="select c.CategoryId,c.CategoryName,count(i.Name) from categories c left join items i using(CategoryID) group by c.CategoryId,c.CategoryName";
     $rs=mysql_query($qry);
     while($row=mysql_fetch_row($rs))
     {
         if($i==2)
         {
          $qry="select i.ItemID,i.Name from items i where i.CategoryId=" . $row[0] . " and i.CustomerId=" . $mid;
          
         }
         else
           $qry="select i.ItemID,i.Name from items i where i.CategoryId=" . $row[0];
         $str.='<li class="closed"><span class="folder">'. $row[1] . '</span><ul>';
         $rss=mysql_query($qry);
         $n=mysql_num_rows($rss);
         for($count=0;$count<$n;$count++)
         {
                $rows=mysql_fetch_row($rss);      
                          
                 $str.='<li><span class="file"><a class="flink" href="javascript:showprod(' . $rows[0] .')">' . $rows[1]  . '</a><input type="hidden" id="c' . $rows[0] .'" value="' . $row[0] . '"></input></span></li>';
         }
         if(isset($_SESSION['id'])) 
            $str.='<li><span class="file"><a href="javascript:insertprod(' . $row[0] . ')" class="flink">Add Product</a></span></li> ';   
         
         $str.=' </ul></li>';      
     }
     $str.="</ul>";
     echo $str;     
  ?> 

Is there something wrong.

 

Thanks and Regards

Link to comment
https://forums.phpfreaks.com/topic/196198-mysql-fetch-problem/
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.