如何将上面数组分两条记录插入数据库?即[0]一条,[1]一条 ------解决方案-------------------- foreach($arr as $v){
mysql_query("insert into talbe.....");
} ------解决方案--------------------
这个效率太低,生成一句sql较好。 ------解决方案--------------------
如果上面这样写,有N条记录,就要执行N条插入语句,如果你拼成一个
INSERT INTO table_name (field1,field2,....)
VALUES
(value1,value2,...),
(value3,value4,...)....
那么只要执行一次就可以了。
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn