Count Query

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Count Query

    Code:
    TABLE `files` (
      `id` int(11) NOT NULL auto_increment,
      `infolder` text NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5;
    
    
     TABLE `cats` (
      `id` int(10) NOT NULL auto_increment,
      `cat_sub` text NOT NULL,
      `cat_o` text NOT NULL,
      `type` tinyint(4) NOT NULL,
      PRIMARY KEY  (`cat_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20;







    I have these two database i wanna count the number of files from files database where infolder is cat_sub of the cats where type equal to 1 i am confuse in it lol if any can help then its high appreicated

    I want to print them in loop like
    Code:
    $q_cats = @mysql_query("SELECT * FROM cats where type = '0' ORDER BY id ASC LIMIT $s,$l;");
    while($cat = @mysql_fetch_array($q_cats))
     {
     echo"($subcat/$filescount)";
     }
    subcat is category inside cats where cat_o is id the of category in which it is.
    and filescount is ..........

    #2
    what is $filescount? cos there is no indication to what that is.
    but you want it more like this:
    Code:
     $q_cats = @mysql_query("SELECT * FROM cats where type = '0' ORDER BY id ASC LIMIT $s,$l;");
    while($cat = @mysql_fetch_array($q_cats))
    {
    echo"($cat[1]/$cat[*?*])";
    }
    Change the *?* to the apropriate item you are selecting

    Comment

    Working...
    X