摘要: 1 <?php 2 3 class runtime 4 { 5 6 7 function __construct() { 8 $db_config = array( 9 'host' => '127.0.0.1',10 'port' => 3306,11 'user' => 'root',12 'pwd' => 'root',13 'dbname' => 'test'14 );15 $link = mysql_con 阅读全文
posted @ 2013-03-26 22:21 /折磨 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 直接循环插入数据库 以1000条记录为1次 (第一次):137.8毫秒(第二次):152.8毫秒(第三次):120.1毫秒(第四次):119.9毫秒(第五次):124.7毫秒(第六次):129.6毫秒(第七次):131.5毫秒(第八次):122.5毫秒(第九次):117.4毫秒(第十次):123毫秒第二种 也是以1000条记录为1次 (第一次):7.1毫秒(第二次):40.3毫秒(第三次):6.8毫秒(第四次):9.8毫秒(第五次):10.1毫秒(第六次):7.1毫秒(第七次):10毫秒(第八次):6.9毫秒(第九次):7.2毫秒(第十次):7.8毫秒 阅读全文
posted @ 2013-03-26 22:20 /折磨 阅读(573) 评论(0) 推荐(0) 编辑
摘要: 1 for ($i=1; $i<=1000;$i++) { 2 $id = '100';3 $username = 'xm';4 $sql[] = '('.$id.',"'.$username.'")'; 5 } 6 mysql_query('insert into tb_user(id,username) values '.implode(',',$sql)); 阅读全文
posted @ 2013-03-26 21:19 /折磨 阅读(123) 评论(0) 推荐(0) 编辑