We recently moved over some of our templates to use the Query module to reduce the number of DB queries happening.

However I'm now experiencing an issue where some of the field data is being returned un-escaped and when I try and output the result using PHP's json_encode() function I'm getting a PHP error.

:  syntax error, unexpected 'flying' (T_STRING), expecting ')' in 

Here's my question:

  1. Should the Query Module escape strings?
  2. If not why not and how should I overcome this?
  3. I'm not able to use MySQL REPLACE(column, '"', ''') as this causes the QUERY module to throw and SQL error. Any other way I can escape the quotes?

Ok, so I managed to find a solution using Low Replace, this handy plugin escapes the strings before my PHP code gets to it hence fixing the issue.

{exp:low_replace find="QUOTE|NEWLINE" replace="\QUOTE|SPACE" multiple="yes"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.