sw0o0sh Posted June 27, 2010 Share Posted June 27, 2010 I can't find anything on Google about this and a few websites do this that I know of. Basically, at the bottom of the page, it'll typically say something like: Page loaded in X.X seconds with X queries executed. How does one count the amount of SQL queries generated with PHP? Link to comment https://forums.phpfreaks.com/topic/205968-showing-the-number-of-sql-queries-generated-with-php/ Share on other sites More sharing options...
jcbones Posted June 27, 2010 Share Posted June 27, 2010 Something like: //Top of page. $start = microtime(true); $queryCount = 0; mysql_query($sql); ++$queryCount; mysql_query($sql); ++$queryCount; $end = microtime(true); echo 'Page created in ' . ($end - $start) . ' seconds, with ' . $queryCount . ' Queries.'; Link to comment https://forums.phpfreaks.com/topic/205968-showing-the-number-of-sql-queries-generated-with-php/#findComment-1077771 Share on other sites More sharing options...
Genesis730 Posted June 27, 2010 Share Posted June 27, 2010 Take a look at this function, call it after the execution of each mysql_query command and create a running total Link to comment https://forums.phpfreaks.com/topic/205968-showing-the-number-of-sql-queries-generated-with-php/#findComment-1077773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.