Home > Backend Development > PHP Tutorial > php向mysql插入1000条数据,如何写?

php向mysql插入1000条数据,如何写?

WBOY
Release: 2016-06-13 13:18:06
Original
903 people have browsed it

php向mysql插入1000条数据,怎么写???
for($i=1;$i{
  $id="100";
  $username="xm";

  $sql="insert into tb_user(id,username) values('$id','$username')";
  mysql_query($sql);
}


我没有设置id和username成主键喔,

可只是插入一条数据,问题出现那里啊?请教高手,谢谢

------解决方案--------------------
不要频繁操作数据库。建议

PHP code

 for ($i=1; $i
                 
              
              
        
            
Copy after login
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