It's not hard, you just need to create a wrapper class and replace all mysql_query calls with that. The wrapper class can also be used to make a connection to the database and close the resource when you are done.
PHP Code:
$db = new DbMysql($username, $password, $database);
$result = $db->query('SELECT * FROM myTable;');
// example PHP class - should be expanded for you needs
class {
private static $queryCount = 0;
public function __construct($username, $password, $database) {
}
public static function getQueryCount() {
return self::$queryCount;
}
public query($query) {
++self::$queryCount;
return mysql_query($query);
}
}
Also, have a look at the PHP 5 OOP links in my sig. I have done just this.