PHP循环插入数据库为什么只是可以插入1000多条就停止了

WBOY
Release: 2016-06-23 14:10:35
Original
1323 people have browsed it

<?php	$link=mysql_connect('localhost','root','qnmlgb')or die('error');	mysql_select_db('sql',$link);	mysql_query('set names utf8;');	$jks='新的字段表';	for($i=1;$i<10000; $i++ ){		echo $i.'<br>';	mysql_query("insert into `name` values('$i','$jks')");		}mysql_close($link);
Copy after login


====================

照道理应该是插入1万次才停止,但是我看数据库里面只是插入了1014就停止了,看了下ECHO的页面,出现了一个错误  

Fatal error: Maximum execution time of 30 seconds exceeded in E:\web\sql.php on line 10


请问下这样的情况是为什么呢


回复讨论(解决方案)

超时了
循环前执行 set_time_limt(0);

超时了
循环前执行 set_time_limt(0);

嗯,谢谢提醒,少了个i, set_time_limit(0)

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!