get result from database equal today |
I need to get posts of today from database using where.
PHP Code: // Get Today Time in Model (getLatest): PHP Code: $builder = $this->db->table('posts p'); How do can I generate this query using where OR another method?
You can write custom where clause, see number 4 Custom string on this page: http://codeigniter.com/user_guide/databa...cific-data
Try this: PHP Code: $builder->where('created_at >= CURRENT_DATE'); If CI try to protect the field name and mess the query, try this: PHP Code: $builder->where('created_at >= CURRENT_DATE', null, false); |
Welcome Guest, Not a member yet? Register Sign In |