Php Join get 4个表所有结果按id 问题
现在我在codeigniter中编辑表单,我想获得所有四个表的数据。来自控制器的是事件id,我想通过这个id获取数据 模型 错误Php Join get 4个表所有结果按id 问题,php,mysql,codeigniter,Php,Mysql,Codeigniter,现在我在codeigniter中编辑表单,我想获得所有四个表的数据。来自控制器的是事件id,我想通过这个id获取数据 模型 错误 消息:语法错误,意外的“$event\u id”(T\u VARIABLE)可能是您需要字符串连接(否则,中的变量未正确添加到字符串的其余部分) 对于调用未定义的方法CI_DB_mysqli_driver::row_object()错误 您没有选择表名。。。因此,您应该为所需的表/模型添加get('TABLE_NAME')方法 $this->db-&g
消息:语法错误,意外的“$event\u id”(T\u VARIABLE)可能是您需要字符串连接(否则,中的变量未正确添加到字符串的其余部分)
对于调用未定义的方法CI_DB_mysqli_driver::row_object()错误
您没有选择表名。。。因此,您应该为所需的表/模型添加get('TABLE_NAME')方法
$this->db->select('*')
->from('events e')
->join('events_location el','el.events_id =' . $event_id,'left')
->join('events_photos ep',
'ep.events_id =' . $event_id,'left')
->join('push_notifications pn',
'pn.events_id ='. $event_id,'left')
->where('e.event_id =' . $event_id)->get('TABLE_NAME')
->row_object();
调用未定义的方法CI_DB_mysqli_driver::row_object()@RavshanAbdurasulov。。这意味着您的错误已解决,但您还有另一个错误。。。答案更新..这是您的问题,所以。。我不知道。。。我认为这张表与你需要的型号有关。。可能是一个活动?谢谢你,先生!这就是我想要的!抱歉问了这么愚蠢的问题!别担心。。。这也发生在我身上。。你的问题让我进入了一个好的状态,我只是一个新手,但是这个语法正确吗:
“…=”$event\u id,'le…“
?如,'string'$variable,'string'
?第一个字符串后面不也应该有逗号吗?
public function get_list_for_edit($event_id){
return
$this->db->select('*')
->from('events e')
->join('events_location el','el.events_id =' . $event_id,'left')
->join('events_photos ep',
'ep.events_id =' . $event_id,'left')
->join('push_notifications pn',
'pn.events_id ='. $event_id,'left')
->where('e.event_id =' . $event_id)
->row_object();
}
$this->db->select('*')
->from('events e')
->join('events_location el','el.events_id =' . $event_id,'left')
->join('events_photos ep',
'ep.events_id =' . $event_id,'left')
->join('push_notifications pn',
'pn.events_id ='. $event_id,'left')
->where('e.event_id =' . $event_id)->get('TABLE_NAME')
->row_object();