php插进数据的办法
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">插进</span>数据库的两种<span style="color: black;">办法</span></h3>创建数据表<div style="color: black; text-align: left; margin-bottom: 10px;">CREATE TABLE `area` (
`id` int NOT NULL AUTO_INCREMENT COMMENT ID,
`pid` int DEFAULT NULL COMMENT 父id,
`shortname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 简<span style="color: black;">叫作</span>,
`name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 名<span style="color: black;">叫作</span>,
`mergename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 全<span style="color: black;">叫作</span>,
`level` tinyint DEFAULT NULL COMMENT 层级:1=省,2=市,3=区/县,
`pinyin` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 拼音,
`code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 长途区号,
`zip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 邮编,
`first` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 首字母,
`lng` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 经度,
`lat` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 纬度,
PRIMARY KEY (`id`),
KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT=地区表;</div><span style="color: black;">经过</span>insert语句进行数据<span style="color: black;">插进</span> <span style="color: black;">咱们</span>正常一条两条的数据是<span style="color: black;">经过</span>insert<span style="color: black;">插进</span><span style="color: black;">这般</span><span style="color: black;">亦</span>是简单快捷,<span style="color: black;">然则</span><span style="color: black;">倘若</span>遇到<span style="color: black;">海量</span>数据<span style="color: black;">必须</span>进行<span style="color: black;">插进</span>时,insert的速度会慢不少<div style="color: black; text-align: left; margin-bottom: 10px;">INSERT INTO `area` (`id`, `pid`, `shortname`, `name`, `mergename`, `level`, `pinyin`, `code`, `zip`, `first`, `lng`, `lat`) VALUES (1, 0, 北京, 北京, 中国,北京, 1, beijing, , , B, 116.405285, 39.904989);
INSERT INTO `area` (`id`, `pid`, `shortname`, `name`, `mergename`, `level`, `pinyin`, `code`, `zip`, `first`, `lng`, `lat`) VALUES (2, 1, 北京, 北京市, 中国,北京,北京市, 2, beijing, 010, 100000, B, 116.405285, 39.904989);</div><span style="color: black;">经过</span>load data local infile加载<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">官方文档 <a style="color: black;"><span style="color: black;">https://</span><span style="color: black;">dev.mysql.com/doc/refma</span><span style="color: black;">n/5.7/en/load-data.html</span></a>总结下来<span style="color: black;">便是</span>以下语句</p>
<div style="color: black; text-align: left; margin-bottom: 10px;">$fileName = 文件名,<span style="color: black;">必须</span>有权限加载到
</div>
我完全同意你的观点,说得太对了。
页:
[1]