Possible Duplicate:
Codeigniter ActiveRecord: join backticking
I want to give a value in the place of column name but it is not able to recognize it and it is giving me error. Here is my code:
$this->db->select('*')->from('users')->where('users.ID',$this->session->userdata('user_id'));
$this->db->join('contact','contact.ID = 1','left');
$result = $this->db->get()->row_array();
The issue is with the join and it is not accepting value.It is giving me this error
error:
Unknown column '1' in 'on clause'
I have to use 1 because there is no relation between the tables and in the contact table there is only one row.
Thanks every one for reply.I found an alternative,using this:
$this->db->query("SELECT * FROM (users) LEFT JOIN 'contact' ON contact.ID = ? WHERE users.ID = ?",array(1,$user_id));,doing this codeigniter does not give me any error.