how to select database content foreach month ?

Posted by mehdi on Stack Overflow See other posts from Stack Overflow or by mehdi
Published on 2010-04-08T19:07:53Z Indexed on 2010/04/08 19:13 UTC
Read the original article Hit count: 227

i have table named visits in my database like this :

id ip action_date|time_stamp

i use this code to store site visits

/* Hits table has an auto-incrementing id and an ip field */

        // Grab client IP
        $ip = $this->input->ip_address();

        // Check for previous visits
        $query = $this->db->get_where('visits', array('ip' => $ip), 1, 0);
        $query = $query->row_array();

        if (count($query) < 1 )
        {
            // Never visited - add
            $this->db->insert('visits', array('ip' => $ip) );
        } 

it's working nice . but my client need to know how many visits they have in month . how can i do that ? tanks .

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about visitor-statistic