[eluser]Jagar[/eluser]
I'm not sure what i'm doing wrong, but it comes out wrong.
I'm trying to query using active record class using the following query:
Code:
$query = $this->db->select("if(status=1,'Enabled','Disabled') as status")->from('admin')->get();
but I get the following error:
Code:
A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as status FROM (`admin`)' at line 1
SELECT if(status=1, `'Enabled'`, `'Disabled')` as status FROM (`admin`)
I'm translating 0 to Disabled and 1 to Enabled
Thanks