Код: Выделить всё
Select * from foo
where date = STR_TO_DATE('$month/$day/$year','%m/%d/%Y')
and time = STR_TO_DATE('$hour:$minute$ampm', '%l:%i%p')
Код: Выделить всё
public function validate_if_existing($month,$day,$year,$hour,$minute,$ampm)
{
$event_date = "STR_TO_DATE('$month/$day/$year','%m/%d/%Y')";
$event_time = "STR_TO_DATE('$hour:$minute$ampm', '%l:%i%p')";
$this->db->flush_cache();
$query = $this->db->get_where('foo',array('event_date' => $event_date,'event_time'=> $event_time));
return $query->num_rows();
}
Код: Выделить всё
STR_TO_DATE('01/01/2012','%m/%d/%Y')
Подробнее здесь: https://stackoverflow.com/questions/131 ... eck-values
Мобильная версия