我想通过将记录从一个表移动到另一个表来存档学生.这是我尝试使用的代码:
ini_set('memory_limit', '100M');
$sql="Select * from `register` where student_id=".$student_id;
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
//Call the function to archive the table
//Function definition is given below
archive_record(archive,$row);
//Once you archive, delete the record from original table
$sql = "Delete from `register` where student_id=".$student_id;
mysql_query($sql);
function archive_record($archived_tablename,$row)
{
$sql = "insert into $archived_tablename values(";
$i=0;
while($i
{
$sql.="'".$row[$i]."',";
}
$i=$i+1;
$sql.="'".$row[$i]."'";
$sql.=")";
mysql_query($sql);
return true;
}
我遇到的问题是我收到错误:
致命错误:第XX行的/archive-student.php内存不足(分配80478208)(试图分配80216043字节)
有没有不同的方法来做到这一点,除了有一个名为archive的列并从0更改为1?这是因为我有30-50页选择表的记录.
标签:php,mysql,copy
来源: https://codeday.me/bug/20191006/1858219.html