Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:53:23+00:00 2026-05-31T02:53:23+00:00

I would like to archive a student by moving the record from one table

  • 0

I would like to archive a student by moving the record from one table to another. This is the code I am 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;
}

Problem I am having is that i am getting error:

Fatal error: Out of memory (allocated 80478208) (tried to allocate 80216043 bytes) in /archive-student.php on line XX

Is there any different way to do this, except for have a column called archive and changing from 0 to 1? This is because I have 30-50 pages selecting the table’s records. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:53:24+00:00Added an answer on May 31, 2026 at 2:53 am
    INSERT INTO archive_table
    SELECT * FROM original_table WHERE id = 1
    

    simple as that.

    If tables have different column number, other layout etc., you will have to specify columns :too

    INSERT INTO archive_table(field1, field2, field3)
    SELECT field7, field8, field9 FROM original_table WHERE id = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here's my code: insert into archive from temp where temp.field6>archive.field6 i would like to
I would like to test my custom fxrules. I've seen this post : http://weblogs.asp.net/rosherove/archive/2007/02/24/writing-real-unit-tests-for-your-custom-fxcop-rules.aspx
I would like to use Archive Utility.app in an app I'm writing to compress
I have a table with the archive storage engine and I would like to
I have an archive of Dilbert cartoons, and would like to organize them in
Would like to know the c# code to actually retrieve the IP type: Static
I would like to untar an archive e.g. tar123.tar.gz to directory /myunzip/tar123/ using a
I would like to create an archive of the *.jar files in hudson. Currently
I would like make an executable jar archive with eclipse. So into my project
I would like to have a shell script that copies some logs from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.