<?php
$start = microtime();
$arr = array();
for ($i = 0; $i < 1000; $i++) {
array_push($arr, Array
(
'userid' => 'feng003',
'status' => 3,
'confirm_time' => 1427940803,
'pv_total' => 0.00
)
);
}
$sql = 'INSERT INTO test (`userid`,`status`,`confirm_time`,`pv_total`) VALUES';
foreach($arr as $k => $item) {
$sql .= '("' . $item['userid'] . '",' . $item['status'] . ',' . $item['confirm_time'] . ',' . $item['pv_total'] . '),';
}
$sql = rtrim($sql, ',');
$conn=mysql_connect('localhost', 'lee', '111111') or die("error connecting") ; //连接数据库
mysql_query("set names 'utf8'"); //数据库输出编码 应该与你的数据库编码保持一致.南昌网站建设公司百恒网络PHP工程师建议用UTF-8 国际标准编码.
mysql_select_db('test'); //打开数据库
$result = mysql_query($sql,$conn); //查询
echo microtime() - $start;
/*
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `test`
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`u_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`userid` int(11) NOT NULL,
`status` varchar(255) NOT NULL,
`confirm_time` int(10) NOT NULL,
`pv_total` decimal(10,2) NOT NULL,
`name5` varchar(255) NOT NULL,
PRIMARY KEY (`u_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
*/
分类: web
标签:
搜索
标签
study
ab
amap
apache
apahe
awk
aws
bat
centos
CFS
chrome
cmd
cnpm
composer
consul
crontab
css
curl
cygwin
devops
di
docker
docker,docker-compose
ethereum
excel
fiddler
fluentd
framework
front-end
git
gitgui
github
glide
go
golang
gorm
grafana
gzip
ioc
item2
iterm2
javascript
jenkins
jsonp
kafka
laradock
laravel
larval
linux
liunux
log
mac
mac, wi-fi
macos
magento
mariaDB
minikube
mongoDB
msp
mysql
netbeans
nginx
nodejs
nohup
npm
nsq
php
php-fpm
php7
phpstorm
php扩展
Protobuf
python
redis
scp
server
shell
soap
socket
socket5
sql
sre
ssdb
ssh
ssl
study
sublime
swift
system
td-agent
uml
v2ray
vagrant
vagrnat
vim
vpn
vue
vue.js
webpack
webrtc
websocket
webtatic
windows
windows7
word
wps
xdebug
yarn
yii2
yum
zookeeper
世界国家
互联网
以太坊
分类
前端
小程序
打印机
排序算法
搞笑
权限
粤语
缓存
网络
虚拟机
视频
设计模式
项目管理
热门文章
友情链接