Page 1 of 1

No: of mysql-queries executed between a open and close

Posted: Sat Jul 21, 2007 10:24 am
by anjanesh
Hi

Is there any method (php or mysql) to know the number of queries executed between a connection open and close ?

Code: Select all

$db = mysql_connect(...);
mysql_query(); // say some 10 times
mysql_close($db);
echo mysql_queries_executed($db);
Thanks

Posted: Sat Jul 21, 2007 10:34 am
by Benjamin
You can run them all through a common method or function and attach a counter to it.

Posted: Sat Jul 21, 2007 10:50 am
by anjanesh
I was hoping there was way to get this done using mysqli atleast - for each object of mysqli created.

Posted: Sat Jul 21, 2007 11:45 am
by superdezign
I've never used it before, but if they don't give you a way, then there probably isn't one. If you made a database interaction class, you could easily keep up with how many queries are performed.