I want to join two tables but comparison is with external variable, like $ext_user
$this->db->join('ec_details2', 'ec_details.user_id = ec_users.user_id','INNER');
Instead of ec_users.user_id in above code i want to use $ext_user, how can i do this like below?
$this->db->join('ec_details2', 'ec_details.user_id = $ext_user','INNER');
If i do with my 2nd option it will not take $ext_user as variable, but taking as complete string!
Thanks,
I think it is about variables will not be expanded when they occur in single quoted strings.
And it work by the double-quoted.
$this->db->join('ec_details2', "ec_details.user_id = $ext_user",'INNER');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With