title: Is there a way to accept apostrophes when inserting variables to MYSQL?
body: <p>I'm having some trouble where I'm pulling values from both a session and a form - for a ticketing system - and when someone uses an apostrophe, it breaks the code.</p>
  <p>See below where I receive the data:</p>
  <pre><code>$name = $_POST[&quot;name&quot;];
  $topic = $_POST[&quot;topic&quot;];
  $urgency = $_POST[&quot;urgency&quot;];
  $subject = $_POST[&quot;subject&quot;];
  $details = $_POST[&quot;details&quot;];
  $username = $_SESSION[&quot;username&quot;];
  $imgloc = $_SESSION[&quot;imgloc&quot;];
  $isit = $_SESSION[&quot;isit&quot;];
  </code></pre>
  <p>I later insert it into my MSQL database here:</p>
  <pre><code>$sql = &quot;INSERT INTO tickets (id, ticketname, urgency, topic, submitted, subject, details, isticketimage, imgloc) VALUES ('', '$name', '$urgency', '$topic', '$userno', '$subject', '$details', '$isit', '$imgloc')&quot;;
  </code></pre>
  <p>How would I amend this code to avoid apostrophe's breaking my mysql command?</p>