title: Migration to PHP 5.6: Writing a MySQL wrapper
body: <p>I have to move a WebSite to PHP 5.6. Therefore, I need to change the way PHP connects to MySQL from the mysql_-like-type to either PDO or mysqli.</p>
  
  <p>Someone proposed to write a wrapper (class), so that the old way of using</p>
  
  <pre><code>$db = mysql_connect("localhost", "testusr", "secretpass");
  mysql_select_db("testdb", $db);
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>$db = new PDO("mysql:host=localhost;dbname=testdb", "testusr", "secretpass");
  </code></pre>
  
  <p>Apart from the connection, I have only basic SQL queries like INSERT, SELECT and DELETE.</p>
  
  <p>Is there already such a thing that "translates" old mysql_ queries to mysqli or PDO?</p>
  
  <p>It could maybe look like this:</p>
  
  <pre><code>function mysql_connect_wrapper ($host, $user, $pwd) {
  $db = new PDO("mysql:host=localhost;dbname=testdb", "testusr", "secretpass");
  return $db;
  }
  
  $db = mysql_connect_wrapper("localhost", "testusr", "secretpass");
  </code></pre>
  
  <p>Thanks a lot!</p>