All I want do to is simply get the result of how long (in seconds) the PHP takes to process the SQL query. Am I on a right track? Is my code correct to get the result I want?
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test3", $con);
$start = microtime(TRUE);
$result = mysql_query("SELECT * FROM `test`
ORDER BY `test`.`test2` DESC
LIMIT 0,100");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>test1</th>
<th>test2</th>
<th>test3</th>
<th>test4</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['test1'] . "</td>";
echo "<td>" . $row['test2'] . "</td>";
echo "<td>" . $row['test3'] . "</td>";
echo "<td>" . $row['test4'] . "</td>";
echo "</tr>";
}
echo "</table>";
$end = microtime(TRUE);
$sqlTime = $end - $start;
mysql_close($con);
echo $sqlTime
?>