Groovy website database query counter ..thing

ReDuX 0 Tallied Votes 139 Views Share

You've seen those sites that say how many seconds it took to parse the page and how many database queries comprised the page. Well heres the database query bit...

function mysql_query_2($query){
$_SESSION['queries']++;
return mysql_query($query);

// now use mysql_query_2() function in place of mysql_query()
// Each query will execute exactly the same but count up in
// session variable 'queries'

echo "$_SESSION['queries']";

// just output it somewhere like above...
klinke 0 Newbie Poster

About as small and clean as it gets. Nice one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.