title: htmlspecialchars equivalent for mysql
body: <p>I am querying a database for userInput text which was obtained from a form, and will display that text in an HTML page.  To prevent XSS, I need to iterate over the results and apply htmlspecialchars(), Sure, I change change fetchAll() to fetch() and apply htmlspecialchars() there, but it sure would be nice to use a native MySQL function and include it in my query.  I searched but couldn't find one.  Does one exist?  Am I able to create my own?  Thanks</p>
  
  <pre><code>$sql ='SELECT userInput FROM table WHERE fk_id=123';
  $stmt = db::db()-&gt;query($sql);
  return $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  </code></pre>