简体   繁体   English

使用CodeIginiter从表中获取记录时出错

[英]Getting error while fetching record from table using CodeIginiter

I am getting the following error while fetching record from table using CodeIgniter. 使用CodeIgniter从表中获取记录时出现以下错误。

Error: 错误:

<b>Fatal error</b>:  Call to a member function result() on a non-object
<p>Severity: Error</p>
<p>Message:  Call to a member function result() on a non-object</p>

I am providing my code below: 我在下面提供我的代码:

$this->db->select('pt_tours.tour_id,pt_tours.tour_title,pt_tours.tour_location,pt_tours.tour_days,pt_tours.tour_nights,pt_tours_departure_dates.tour_id,pt_tours_departure_dates.dep_dates');
    $this->db->join('pt_tours_departure_dates', 'pt_tours.tour_id = pt_tours_departure_dates.tour_id', 'left');
    $this->db->where('CONCAT(","','pt_tours_departure_dates.dep_dates','",") like "%,"$date",%"');
 $res = $this->db->get('pt_tours')->result();
echo $this->db->last_query();exit;

Here I am trying to get record by matching the date value with column which contains the comma separated string value. 在这里,我试图通过将日期值与包含逗号分隔的字符串值的列进行匹配来获取记录。

我认为您可以将result()替换为result_array()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM