-2

我有两个 while 循环正在显示数据库中的数据,但由于负载过重而停止工作。

请让我知道如何销毁/清除每个 while 循环上的先前负载。

**Code Example: this is not an exact code, but take it as example**

for ($aw = 1; $aw <= 150000; $aw++) {

$sql="INSERT INTO say (cname,cno,clocation,email) VALUES ('Fin','0743208899','London','fin1991@live.com')"; 
$result=mysql_query($sql);

}
4

1 回答 1

1

构建一个查询,而不是运行 50,000 个查询:

$rows = Array();
for( $aw=1; $aw<=50000; $aw++) $rows[] = "('Fin','0743208899','London','fin1991@live.com')";
mysql_query("INSERT INTO say (cname,cno,clocation.email) VALUES ".implode(",",$rows));
于 2012-07-16T02:25:35.157 回答