我在使用codeigniter get_where函数创建查询以获取特定数据时遇到麻烦。我阅读并理解了该手册,并在代码中使用了它,但是现在当我要从数据库中查询时(例如下面的代码),它不起作用。
模型:
public function load_parents () {
$query = $this->db->get_where('checklist_items', array(('checklist_id' => $checklist_id) && ('parent_id' => $parent_id)));
$result = $query->result_array ();
return $result;
}
错误:消息:语法错误,意外的'=>'(T_DOUBLE_ARROW),预期为')'
我知道代码不正确,但是还有另一种方法可以使它运行吗?
用这个 :
<?php
public function load_parents ()
{
$query = $this->db->get_where('checklist_items', array('checklist_id' => $checklist_id, 'parent_id' => $parent_id));
$result = $query->result_array ();
return $result;
}
?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句