title: MySQL Escape double quotes in query result
body: <p>I have a CONCATENATION problem regarding quotes.
  In my database I have single and double quoted text and then I buld a JSON string with CONCAT,</p>
  
  <pre><code>CONCAT('{"',a,'":"',b,'"}')
  </code></pre>
  
  <p>Lets say we have the following data:</p>
  
  <pre><code>a           b
  Phrase      Monica's mirror
  Phrase      Joe "Hammer" Smith
  Phrase      Oo-la-laaa
  </code></pre>
  
  <p>The concatenation will be</p>
  
  <pre><code>{"Phrase":"Monica's mirror"}
  {"Phrase":"Joe "Hammer" Smith"}
  {"Phrase":"Oo-la-laaa"}
  </code></pre>
  
  <p>As you can see 'Joes "Hammer" Smith' will create an invalid json string.  </p>
  
  <h2>QUESTION</h2>
  
  <p>Is there a way in SQL to escape quotes (in the CONCAT)? so I get this result:</p>
  
  <pre><code>{"Phrase":"Monica's mirror"}
  {"Phrase":"Joe \"Hammer\" Smith"}
  {"Phrase":"Oo-la-laaa"}
  </code></pre>
  
  <p>Remember, this is not on the PHP side, it needs to be done in the SQL query,<br>
  Thank you...</p>