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
Post a Comment