当mysqli_fetch_array因内部服务器错误而停止时(500)

时间:2019-05-21 13:57:34

标签: php mysql apache mysqli

我想从mysql表中获取内容到另一个。该表包含〜312000行,仅数字/十进制值,总大小为〜22 MB。 “有趣的事情”:一切正常,但在写入行236991之后,整个skript停止,内部服务器错误500。 mysqli_num_rows 显示正确的值312000,而且我的第二个脚本(下面)按预期工作

PHP 7.0.33 / Mod-PHP / Apache2 / Debian 9

// Stops with an internal Server Error 500  
 $fetch = mysqli_query($connection1,"SELECT `a`,`b`,`c` FROM `table`");
  while($f = mysqli_fetch_array($fetch,MYSQL_ASSOC)) {
  mysqli_query($connection2,"INSERT INTO `table` (a,b,c) VALUES ('$f[a]','$f[b]','$f[c]')");
}

// Works perfect
$val = 0;
$fetch = mysqli_query($connection1,"SELECT `a`,`b`,`c` FROM `table`");
 while($f = mysqli_fetch_array($fetch,MYSQL_ASSOC)) {
 $val++;
 }
 echo $val; // 312000 the correct result

0 个答案:

没有答案