<?php
 
 
include 'timer.class.php';
 
$db_timer = new timer();
 
 
 
// Connect to database here and create the query to be run
 
mysql_connect('localhost', 'root', '');
 
mysql_select_db('database');
 
 
 
 
 
$query = "SELECT * FROM table";
 
 
 
// Start timer before executing query
 
$db_timer->start();
 
$result = mysql_query($query);
 
 
 
// Pause timer
 
$db_timer->pause();
 
 
 
// Echo out the selected data
 
while($row = mysql_fetch_assoc($result)) {
 
    echo print_r($row, true);
 
}
 
 
 
// Create another query
 
$query = "SELECT * FROM table2";
 
 
 
// Unpause the timer
 
$db_timer->pause();
 
 
 
// Execute the query
 
$result = mysql_query($query);
 
 
 
// Stop the timer and get the total execution time
 
$total_time = $db_timer->stop();
 
 
 
// Display details
 
echo 'SQL queries took '.$total_time.' seconds to execute in total';
 
 |