title: Is my PDO query safe from SQL injection
body: <p>I'm fairly new to PDO and wondering if my query below is safe from SQL injection. I'll be using this method throughout the site if so.</p>
  
  <pre><code>    // make connection to DB
  $db = new PDO('mysql:host='.$dateBaseHost.';dbname='.$dateBaseName, $dateBaseUsername, $dateBasePassword);
  $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
  
  //simple query and binding with results
  $query = $db-&gt;prepare(" SELECT * FROM `profile` WHERE `fullname` = :fullname ");
  
  $search = (isset($_GET['search']) === true) ? $_GET['search'] : '' ; // ? : shorthand for if else
  
  // bind parameters - avoids SQL injection
  $query-&gt;bindValue(':fullname', $search);
  
  //try... if not catch exception
  try {
      // run the query
      $query-&gt;execute();
  
      $rows = $query-&gt;fetchAll(PDO::FETCH_ASSOC);
      echo '&lt;pre&gt;', print_r($rows, true),'&lt;/pre&gt;';
  }
  catch (PDOException $e){
      sendErrorMail($e-&gt;getMessage(), $e-&gt;getFile(), $e-&gt;getLine());
  }
  </code></pre>