title: How to properly use mysqli_real_escape_string
body: <p>I am having a problem that I just can not wrap my head around.</p>
  
  <p>When saving a name to mysql database if the name contains an apostrophy (single quote) I am getting unexpected results.  </p>
  
  <p>I have saved the name using <code>$name = mysqli_real_escape_string($con, $name);</code>where <code>$con</code> is the connection string and <code>$name</code> is the name.  However instead of <code>$name</code> coming back as Peter O'Toole,  what I am getting is Peter O\ </p>
  
  <p>Can someone please tell me where I am going wrong here?</p>