Welcome Guest, Not a member yet? Register   Sign In
Database select a set value

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..

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

Theme © iAndrew 2016 - Forum software by © MyBB