Now I am doing edit form in codeigniter and I want to get all four tables data. From controller comes event_id and by this id I want to get data.
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();
}
Message: syntax error, unexpected '$event_id' (T_VARIABLE)
could be you need string concatenation (othewise the variable in not correctly added to the rest of the 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();
}
for Call to undefined method CI_DB_mysqli_driver::row_object() error
You are not selecting table name ... so you should add the get('TABLE_NAME') method for the table/model you need
$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();