Sorry if i am too straightforeward with this problem, but i have the following and its displaying times at the end with numbers suck as "10" and "20"
but really the code takes like 3 seconds to generatePHP Code:<html>
<style>
body {font-family: verdana; font-size: 10px}
</style>
<body>
<?PHP
error_reporting(E_ALL);
Function now_time ()
{list ($msec,$sec) = explode(" ",microtime());
$msec_now = ((float)$sec + (float)$msec);
return $msec_now;}
// Variables
$db_server = "LOCALHOST";
$db_database = 'xyuri_benchmark_test';
$db_user = 'root';
$db_pass = '';
$link1 = mysql_connect($db_server, $db_user, $db_pass);
mysql_query("Create database $db_database");
mysql_select_db("$db_database");
ECHO "<li><small>Database (<i>$db_database</i>) created sucessfully.</small><br/><br/>";
$start_1 = now_time ();
/* START Table 1 */
mysql_query("Create Table table_1(id int auto_increment primary key)");
mysql_query("Insert into table_1 values ('0')");
ECHO '<li><small>First table created sucessfully.</small><br/>';
$x = (int)0;
WHILE ($x < (int)200)
{
mysql_query("UPDATE table_1 SET id = $x");
$x++;
} unset($x);
/* FINISH Table 1 */
$finish_1 = now_time ();
$start_2 = now_time ();
/* START Table 2 */
mysql_query("Create Table table_2(id int auto_increment primary key)");
mysql_query("Insert into table_2 values ('0')");
ECHO '<li><small>Second table created sucessfully.</small><br/>';
$x = (int)0;
WHILE ($x < (int)200)
{
mysql_query("UPDATE table_1 SET id = (id + 1)");
$x++;
} unset($x);
/* FINISH Table 2 */
$finish_2 = now_time ();
mysql_query("drop database $db_database");
ECHO "<br/><li><small>Database (<i>$db_database</i>) dropped sucessfully.</small><br/><br/>";
?>
<b>Results:</b><br/>
<?PHP
$time_1 = ((float)$finish_1 - (float)$start_1);
$time_2 = ((float)$finish_2 - (float)$start_2);
ECHO '1' . round($time_1,2) . '<br/>';
ECHO '2' . round($time_2,2) . '<br/>';
?>
</body>
</html>
any visual problems ?






Bookmarks