I would like to archive the student by moving the record from one table to another. This is the code I'm trying to use:
<?php 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<(count($row)-1)) { $sql.="'".$row[$i]."',"; } $i=$i+1; $sql.="'".$row[$i]."'"; $sql.=")"; mysql_query($sql); return true; }
The problem is that I get the error:
Fatal error: Out of memory (80478208 allocated) (tried to allocate 80216043 bytes) in / archive -student.php on line XX
Is there any other way to do this, except to have a column called an archive, and vary from 0 to 1? This is because I have 30-50 pages that select table entries. :)
source share