Bonjour, is there a function to return the number of MySQL queries within a script?
Cheers
Printable View
Bonjour, is there a function to return the number of MySQL queries within a script?
Cheers
i dont know if this will help you or not:
http://www.howtoforge.com/forums/arc...p/t-14294.html
It does in a way, it tells me that it cannt easily be done, and that is fine :D
Thanks Dylan, many happy return; ;)
ILMV
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.
Also, have a look at the PHP 5 OOP links in my sig. I have done just this.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);
}
}