CodeIgniter Forums

Full Version: escape string problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]tim1965[/eluser]
I am trying to query my database using a variable $uname which i pull from a session. If i dump the variable it looks like this
Quote:
string(7) "tom4444".
Quote:
When i run my query

$this->db->select('property_id')->from('master_property_reference')->where('username',$uname);
$query = $this->db->get();

I get the following error message
Quote:
string(7) "tim1965" object(CI_DB_mysql_result)#15 (7) { ["conn_id"]=> resource(45) of type (mysql link persistent) ["result_id"]=> resource(55) of type (mysql result) ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> int(1) ["row_data"]=> NULL }
Quote:

I am guessing that it is blowing up on the double quotes in the variable, but i thought these were escaped automatically using active records.

My db is
Quote:
username varchar(12) property_id mediumint(20) date_time_created timestamp
ad_completed varchar(1)
Quote:
Can anybody see anything i am missing ?

El Forum

[eluser]tim1965[/eluser]
Please ignore above. The query was correctly inserting.