How can I wrap the PHP PDO class into my own class?

AcidX

New Member
Sorry if this is wrong or confusing I am very new to using classes and I would like to start learning more about using PDO with mysql.Here is an example code from php.net\[code\]<?php/* Execute a prepared statement by passing an array of values */$sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?');$sth->execute(array(150, 'red'));$red = $sth->fetchAll();$sth->execute(array(175, 'yellow'));$yellow = $sth->fetchAll();?>\[/code\]Generally with just the regular mysql extension, I like to wrap all the default methods into my own method, for example when I dont use PDO I have a Classdatabase class when I call this class like this... \[code\]$db = new Database;$db->execute('SQL QUERY GOES HERE');\[/code\]Inside my execute method I would have it run a regualr query but also check if I am admin, If I am admin and running the query, then I count the queries on a page to a session and show it. SO using the PDO class, how could I wrap all it's methods into my own class so I could do something like count the queries ran on a page for certain users?
 
Back
Top