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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

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

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

You can run them all through a common method or function and attach a counter to it.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I was hoping there was way to get this done using mysqli atleast - for each object of mysqli created.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
Post Reply