CodeIgniter Forums
AR select bug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: AR select bug (/showthread.php?tid=6880)



AR select bug - El Forum - 03-15-2008

[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!


AR select bug - El Forum - 03-15-2008

[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));