我的 Sql 查询返回空结果集。格式有没有错误。我在查询中使用了一些 php 变量..
public function getBlockDate($month,$year){
$connection = db::factory('mysql');
$time_from="00-00-00";
$time_to="23-59-59";
$sql = 'select * from blocks WHERE date LIKE "'.$year.'-'.$month.'%" AND (time_From="'.$time_from.'" AND time_to="'.$time_to.'")';
return $connection->getArray($sql);
}
*这里 time_from 和 time_to 表列是时间类型*