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.
    if (isset($_GET['btnSearch']) && !empty($_GET['txtSearch'])) {
        $txtSearch = trim(mysql_real_escape_string($_GET['txtSearch']));
        if (preg_match("/^(?i)BAW[0-9]+/", $txtSearch)) {
            $pilot->pilot_num = strtoupper($txtSearch);
        } else {
            $pilot->name = $txtSearch;
        }
    }
Thank you all.
 
     
     
    