title: Replacing mysql_real_escape_string():
body: <p>As mysql_real_escape_string is now deprecated, I have to change one function on the site that is using it. For the life of me, I can't figure out proper mysqli or pdo code to use. Maybe someone can guide me at the right direction. This is how it currently looks.</p>
  
  <pre><code>    if (isset($_GET['btnSearch']) &amp;&amp; !empty($_GET['txtSearch'])) {
  
          $txtSearch = trim(mysql_real_escape_string($_GET['txtSearch']));
  
          if (preg_match("/^(?i)BAW[0-9]+/", $txtSearch)) {
              $pilot-&gt;pilot_num = strtoupper($txtSearch);
          } else {
              $pilot-&gt;name = $txtSearch;
          }
      }
  </code></pre>
  
  <p>Thank you all.</p>