SQL 查询 : [编辑] [解释 SQL] [创建 PHP 代码] SELECT * FROM `hotkey` WHERE 1 LIMIT 0 , 30 知道各位大哥的意思了,小弟意思是如何跟mysql去相关,谢谢。
还要怎么和mysql相关啊,执行完了,就是和mysql相关了啊
是否是这样,小弟运行了一下,发现时间不正常,这个显示出来的是0.04,但是运行时足足有6秒左右,谢谢。 $nowtime = explode(" ", microtime()); $starttime = $nowtime[1] + $nowtime[0]; $str_sqlgood="select * from company where company like '%".$search."%' order by id desc"; $resultgood=mysql_query($str_sqlgood) or die(mysql_error());$nowtime = explode(" ", microtime()); $endtime = $nowtime[1] + $nowtime[0]; $totaltime = ($endtime - $starttime); echo $totaltime."<br>";
$starttime = $nowtime[1] + $nowtime[0]; for($c=0;$c<5000000;$c++){
$g=1+1;
} $nowtime = explode(" ", microtime());
$endtime = $nowtime[1] + $nowtime[0];
$totaltime = ($endtime - $starttime);
echo $totaltime."<br>";
for循環的三句話是,變量初始化;可以進行循環的條件;變量計數。修改中間的那句話,可以改變循環條件,改變執行次數(不要改成死循環阿)
$starttime = $nowtime[1] + $nowtime[0]; /*
这里可以换上mysql搜索语句,就得出搜索用时
for($c=0;$c<5000000;$c++){
$g=1+1;
}
*/$nowtime = explode(" ", microtime());
$endtime = $nowtime[1] + $nowtime[0];
$totaltime = ($endtime - $starttime);
echo $totaltime."<br>";
SQL 查询 : [编辑] [解释 SQL] [创建 PHP 代码]
SELECT *
FROM `hotkey`
WHERE 1 LIMIT 0 , 30
知道各位大哥的意思了,小弟意思是如何跟mysql去相关,谢谢。
$nowtime = explode(" ", microtime());
$starttime = $nowtime[1] + $nowtime[0]; $str_sqlgood="select * from company where company like '%".$search."%' order by id desc";
$resultgood=mysql_query($str_sqlgood) or die(mysql_error());$nowtime = explode(" ", microtime());
$endtime = $nowtime[1] + $nowtime[0];
$totaltime = ($endtime - $starttime);
echo $totaltime."<br>";