php批量写入如何实现

WBOY
Release: 2016-06-23 13:35:56
Original
963 people have browsed it

这是我的代码,一条可以写入,我想一次批量写入几条,如何实现呢?
name.html

<form id="form1" name="form1" method="post" action="post.php"><input name="name[]" type="text" id="name" value="" size="10" /><input name="name[]" type="text" id="name" value="" size="10" /></form>
Copy after login


post.php
$arr=array();		$arr['name']=trim($_GET['name']);$arr = daddslashes($arr);insert('data',$arr,true);
Copy after login


回复讨论(解决方案)

name后面加个数字
php用for循环读取

你甚至可以再加一个输入框,“ 批量写入次数”

执行插入时,for  这个批量写入次数

我是菜鸟  能给出代码吗

不知道你的insert 方法是如何写的

把insert into table values(1),(2),(3)        中的1、2、3放到数组里  一次插入

insert('data',$arr,true);data就是数据表

搞好了  谢谢关注

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!