CodeIgniter Forums

Full Version: Database select a set value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi, couldnt find anything with the search about this so thought I'd ask...

Im trying to do a select like below to return all the fields of a table + a certain value (a_value) in this case.

$this->db->select( "p.*, 'a_value' as value" );
$this->db->from( "table p" );

Now this works in mysql but I think CI is escaping the quotes or something. I've tried \' but it still won't work!

Any ideas whats going wrong here ?

Many thanks..

El Forum

You are right, CI does escaping on the fields to prevent 'evil' stuff from coming in. You can tell it not to by adding 'false' as a second argument:
$this->db->select("p.*, 'a value' as value", false);