On Fri, Mar 25, 2011 at 8:50 AM, Brian J. Rogers <[email protected]> wrote:
>  ...
>  include(config.php);
>
>  class Mysql {
>
>     private $conn;
>
>     function __construct() {
>
>         $this->link = mysql_pconnect(host,user,pass);
>
>         // check connection and handle errors
>         // if passes, select db after a check it as well
>
>         return $this->link;
>
>     }
>
>     function foo($sql) {
>
>         // something really cool
>
>     }
>
>  }
>
>  //-----------
>
>  So I want to replace the connection part in my constructor with a PDO
>  connection. Hope that helps clarify things.
>...

I am not sure what it gets you, but you can just replace:
  $this->link = mysql_pconnect(host,user,pass);
with:
  $this->link = new PDO("... mysql dsn ...", $user, $pass);

... and keep the same wrapper. Then switch all the methods to use the
PDO equivalents.

Alvaro
--
http://www.alvarocarrasco.com
https://github.com/alvaroc1

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to