Welcome Guest, Not a member yet? Register   Sign In
AR select bug
#1

[eluser]kjackson7_93[/eluser]
I have the following code in my model:
Code:
$this->db->select('concat(u1.first_name," ",u1.last_name) as author',FALSE);
$this->db->select('if(second_id is not NULL,concat(u2.first_name," ",u2.last_name),"N/A") as second',FALSE);

and result SQL looks like:
Code:
concat(u1.first_name, " ", u1.last_name) as author,
if(second_id is not NULL, concat(u2.first_name, u2.last_name), "N/A") as second

Notice the second concat is missing the " ". The first one works correctly so I'm guessing this is a bug.

Any ideas? Thanks!
#2

[eluser]Seppo[/eluser]
It is a bug... but it's hard to fix... as workaround I suggest you
Code:
$this->db->select(array('if(second_id is not NULL,concat(u2.first_name," ",u2.last_name),"N/A") as second',FALSE));
$this->db->select(array('concat(u1.first_name," ",u1.last_name) as author',FALSE));




Theme © iAndrew 2016 - Forum software by © MyBB