Welcome Guest, Not a member yet? Register   Sign In
MySQL query to get number of posts
#1

[eluser]CodeIgniterNoob[/eluser]
Hi, I have in one of my models, a function:

Code:
function getTopCategories()
    {
        $this->db->where('parentid',0);
        $Q = $this->db->get('categories');
        
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[$row['id']] = $row['name'];
            }
        }
        
    $Q->free_result();  
    return $data;
    }


What Im trying to do is, get a number of live posts associated with each category. Just a number (4) for example.

Can anyone throw me in the right direction? Thanks.


Messages In This Thread
MySQL query to get number of posts - by El Forum - 11-04-2008, 11:06 AM
MySQL query to get number of posts - by El Forum - 11-04-2008, 02:28 PM
MySQL query to get number of posts - by El Forum - 11-04-2008, 03:06 PM
MySQL query to get number of posts - by El Forum - 11-04-2008, 05:41 PM
MySQL query to get number of posts - by El Forum - 11-04-2008, 07:59 PM
MySQL query to get number of posts - by El Forum - 11-05-2008, 09:32 AM
MySQL query to get number of posts - by El Forum - 11-05-2008, 10:48 AM
MySQL query to get number of posts - by El Forum - 11-05-2008, 11:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB