mysql - How to select a date less than the current one? -


i want load appointment history of customer db, each record have start_datetime , end_datetime, query looks this:

$query = $this->db         ->select('*')         ->from('appointments')         ->where('id', 5) 'id of record select         ->where('start_datetime' ) 'here's indecision         ->get()->result_array(); 

essentially record load should record previoulsly of current datetime. how can pass condition in clause?

try this

$now = date('y-m-d h:i:s'); # current time stamp $query = $this->db         ->select('*')         ->from('appointments')         ->where('id', 5)         ->where(start_datetime <= $now ) # date($now)         ->get()->result_array(); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -