how to count how many jobs are in each categories

The following code prints out categories on my website. how can I make it so that it shows how many projects are there in each category. for example Article writing(2) meaning there are currently 2 projects under the category Article writing.

[php]

    <?php if(isset($categories) and $categories->num_rows()>0) { $i=0; foreach($categories->result() as $category) { if($category->is_active==1) { //$name = replaceSpaceWithUnderscore($category->category_name); $name =$category->category_name; ?>
   <li><a href="<?php echo site_url('project/category/'.$name); ?>"><?php echo $category->category_name;?></a></li>
    <?php $i++; 
   }
}

} ?>

[/php]

here is my website = bejees.net for reference.

You would have to use mysql num rows or SELECT count on the table which has all the projects and do a where clause with the category. but you did not list enough information here to go by so this is all I can give you.

Sponsor our Newsletter | Privacy Policy | Terms of Service