码迷,mamicode.com
首页 > 数据库 > 详细

批量插入数据 mysql

时间:2017-08-20 12:35:42      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:bsp   val   pre   ber   font   sql   color   date()   exec   

        $sql = "INSERT INTO `fenqi`.`sdfq_customer_order` (
                    `order_sn`,order_status,customer_id,remark,price,need_price,create_time,fenqi_type_id,fenqi_num_id,buiness_area_id
                    )VALUES";
        $sqle = "";
        for ($i = 20001; $i <= 40000; $i++) {
            $sqle .= "(" . setOrderNumber() . ",2,$i,ramark" . $i . ",20000,20000," . fqdate() . ",4,7,270),";

//        $sql = substr($sql, 0, strlen($sql) - 1);
            if ($i % 1000 == 0) {
                $sqle = rtrim($sqle, ",");
                $dosql = $sql . $sqle;
                Db::execute($dosql);
                $sqle = "";
            }
        }

 

批量插入数据 mysql

标签:bsp   val   pre   ber   font   sql   color   date()   exec   

原文地址:http://www.cnblogs.com/clearsice/p/7399250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!