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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:43:431125browse

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
                 
              
              
        
            
Statement:
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
Previous article:远程连接mysql 10060异常Next article:php文件上载