Gettings records by cureent date,week, and month in php mysql not working -


i trying records per current day, week , month in php mysql. date column of date type. issue here week records , months records getting same below script. here code, have look.

public function gettodaycoming(){     $connection = db::factory('mysql');     $sql = "select * bookings,bookers ";     $qualifier = ' bookings.booker_id = bookers.id                    , ((status ="'.appglobal::$bookingstatus['approve'].'"                    or status ="'.appglobal::$bookingstatus['rescheduled'].'"                    or status ="'.appglobal::$bookingstatus['reconsulted'].'")                    , date=date( now() ))                   order date asc';      $sql. = $qualifier;          return  $valuearray = $connection->getarray ($sql );         } public function getweekcoming() {     $connection = db::factory('mysql');     $sql = "select * bookings,bookers ";     $qualifier = ' bookings.booker_id = bookers.id                     , ((status ="'.appglobal::$bookingstatus['approve'].'"                     or status ="'.appglobal::$bookingstatus['rescheduled'].'"                     or status ="'.appglobal::$bookingstatus['reconsulted'].'")                     , date > date_sub(now(), interval 1 week)) order date asc';     $sql. = $qualifier;     return  $valuearray = $connection->getarray( $sql ); } public function getmonthcoming() {     $connection = db::factory('mysql');     $sql = "select * bookings,bookers ";     $qualifier = ' bookings.booker_id = bookers.id                     , ((status ="'.appglobal::$bookingstatus['approve'].'"                     or status ="'.appglobal::$bookingstatus['rescheduled'].'"                     or status ="'.appglobal::$bookingstatus['reconsulted'].'")                     , date > date_sub(now(), interval 1 month)) order date asc';     $sql. = $qualifier;     return  $valuearray = $connection->getarray( $sql ); } 

aah, saw think

date > date_sub(...) 

should be

date between cur_date() , date_add(cur_date(), interval 1 ...) 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -