Home > Backend Development > PHP Tutorial > 怎么插入数据库,菜鸟求代码,

怎么插入数据库,菜鸟求代码,

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:03:12
Original
979 people have browsed it


求一下数据插入数据库的代码,求详解,谢谢
















回复讨论(解决方案)

shu[]-------->为什么都用数组格式命名呢,可用直接用shu,danwei之类的,在别一个页面采$_POST['shu']获取变量,再存入数据库中就可以了

直接用shu?danwei?能插入多行数据?

$names=$_POST['name'];$danweis=$_POST['danwei'];$shus=$_POST['shu'];for($i=0;$i<count($names);$i++){      $sql="insert into tt(name,danwei,shu) values('$names[$i]','$danweis[$i]','$shus[$i]')";	  mysql_query($sql);}
Copy after login

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