title: real escape string and mysqli prepare statement conflict
body: <p>I'm using real escape string and prepared statement in mysqli in that case Ii face a problem when am giving input single quote it saved in database as </p>
  
  <pre><code>"  \'   "
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>$db = new mysqli('localhost', 'root', '', 'test1');
  
  if($db-&gt;connect_errno &gt; 0)
  {
      die('Unable to connect to database [' . $db-&gt;connect_error . ']');
  
  }
  $s="a'a";
  $s=$db-&gt;real_escape_string($s); 
  $sql="insert into table1 values(?,?)";
  $id="";
  $stmt=$db-&gt;prepare($sql);
  $stmt-&gt;bind_param('ss',$id,$s);
  $stmt-&gt;execute();
  if($stmt-&gt;errno)
  {
      echo $stmt-&gt;error;
  }
  else
  {
      echo "inserted successfully";
  }
  </code></pre>
  
  <p>Inserted value is <code>id=0</code> and <code>val=a\'a</code>.</p>
  
  <p>So how can I validate my user input?</p>