怎么提高执行效率

WBOY
Release: 2016-06-13 12:39:56
Original
904 people have browsed it

如何提高执行效率

<br />
for($i=0; $i<count($r); $i++)<br />
	{<br />
		$var = explode(" ,",$r[$i]);<br />
		$barcode = $var[0];<br />
		$num = $var[1];<br />
		$sql = "insert into `".$t."`(barcode,num) values('".$barcode."','".$num."')";<br />
		echo $sql.'<br />';<br />
		mysql_query($sql);<br />
	}<br />
Copy after login


一共有6000多条记录,如果每条记录都执行insert into,消耗时间很长,超过默认的90s。有无方法提高执行效率?

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