使用Codeigniter mysql

时间:2019-07-05 06:14:16

标签: php mysql codeigniter phpmyadmin

我在带有MySQL的codeigniter中使用选择查询,但显示以下错误:-

  

类型:ParseError

     

消息:语法错误,意外出现“。$ todayDate”。(T_CONSTANT_ENCAPSED_STRING)

这是我的代码/查询

$todayDate = date('d-m-Y');
if(strtotime($start_time) <= strtotime($end_time)) {

    $time[$i]['start'] = $start;
    $time[$i]['end'] = $end;
}

$selectQuery = "select `id` from `booking` where temp_date = "'.$todayDate.'" and 
(( `start_time` >= "'.$start.'" AND `start_time` <= "'.$start.'" ) || 
(`close_time` >= "'.$end.'" AND `close_time` <= "'.$end.'")) ";
$s=$this->db->query($selectQuery);

0 个答案:

没有答案