Need some help with escaping quotes - 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: Need some help with escaping quotes (/showthread.php?tid=54897) |
Need some help with escaping quotes - El Forum - 09-30-2012 [eluser]nydeveloper[/eluser] I know this should be simple, but no matter what modifications I make to the following line I still wind up with an unexpected T_CONSTANT_ENCAPSED_STRING error. What specific items need to escaped in order for this query to run as expected? Quote:$query = $this->db->query('UPDATE recipes set recipe_order = ABS(REPLACE(SUBSTR(recipe_name, 1, POSITION(' ' IN recipe_name)-1),',','')) + recipe_cost where category_id = 1 AND location_id = '.$location_id.';'); Please note that this query works as expected when running the SQL directly. Need some help with escaping quotes - El Forum - 09-30-2012 [eluser]Bankzilla[/eluser] Try doing any query modifiers outside of the query itself. Also what's up with the ";" in the query? Need some help with escaping quotes - El Forum - 09-30-2012 [eluser]nydeveloper[/eluser] Turned out to be a simple fix - double quotes rather than single quotes outside of the entire query string. |