MySQL: How to select records for this week?
For selecting records of day, week and month use this way:
function my_func($time, $your_date) {if ($time == 'today') { $timeSQL = ' Date($your_date)= CURDATE()';}if ($time == 'week') { $timeSQL = ' YEARWEEK($your_date)= YEARWEEK(CURDATE())';}if ($time == 'month') { $timeSQL = ' Year($your_date)=Year(CURDATE()) AND Month(`your_date`)= Month(CURDATE())';}$Sql = "SELECT * FROM your_table WHERE ".$timeSQLreturn $Result = $this->db->query($Sql)->result_array();}