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 8461935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:01:08+00:00 2026-06-10T14:01:08+00:00

I am currently using PHP to create a system locally for user to insert

  • 0

I am currently using PHP to create a system locally for user to insert data into 14 tables located in one page, then end of day all the data in that table should be move into a new table in database automatically named dashboard (will store daily data) but recently I used a button by click manually to take the action and at the same time all the data in 14 tables state above will be delete automatically. It easy to make user insert new data at the next day because today’s data has been moved to another table also current table’s data was empty. I have searching at all website about this matter but don’t get any solution. Hope all you guys can help me out of this problem.

I used INSERT INTO but not working. Where should I used the FROM tag? Because there is 8 table need to transfer, eg: sr1, sr2, sr3 and so on.

My Code as below:

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO sr1_full (date, total_pending, appt_today, percent_appt_today, percent_complete, partial_complete, full_complete, return_technical, return_customer, return_cancel, cancel, reappt, focus, total_tepi, total_bawah) SELECT date, total_pending, appt_today, percent_appt_today, percent_complete, partial_complete, full_complete, return_technical, return_customer, return_cancel, cancel, reappt, focus, total_tepi, total_bawah FROM sr1 TRUNCATE TABLE sr1",
                           GetSQLValueString($_POST['date'], "date"),
                           GetSQLValueString($_POST['total_pending'], "int"),
                           GetSQLValueString($_POST['appt_today'], "int"),
                           GetSQLValueString($_POST['percent_appt_today'], "int"),
                           GetSQLValueString($_POST['percent_complete'], "int"),
                           GetSQLValueString($_POST['partial_complete'], "int"),
                           GetSQLValueString($_POST['full_complete'], "int"),
                           GetSQLValueString($_POST['return_technical'], "int"),
                           GetSQLValueString($_POST['return_customer'], "int"),
                           GetSQLValueString($_POST['return_cancel'], "int"),
                           GetSQLValueString($_POST['cancel'], "int"),
                           GetSQLValueString($_POST['reappt'], "int"),
                           GetSQLValueString($_POST['focus'], "int"),
                           GetSQLValueString($_POST['total_tepi'], "int"),
                           GetSQLValueString($_POST['total_bawah'], "int"));

      mysql_select_db($database_pods, $pods);
      $Result1 = mysql_query($insertSQL, $pods) or die(mysql_error());

      $insertGoTo = "main.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }

    mysql_select_db($database_pods, $pods);
    $query_sr1 = "SELECT * FROM sr1";
    $sr1 = mysql_query($query_sr1, $pods) or die(mysql_error());
    $row_sr1 = mysql_fetch_assoc($sr1);
    $totalRows_sr1 = mysql_num_rows($sr1);

    mysql_select_db($database_pods, $pods);
    $query_sr2 = "SELECT * FROM sr2";
    $sr2 = mysql_query($query_sr2, $pods) or die(mysql_error());
    $row_sr2 = mysql_fetch_assoc($sr2);
    $totalRows_sr2 = mysql_num_rows($sr2);

    mysql_select_db($database_pods, $pods);
    $query_sr3 = "SELECT * FROM sr3";
    $sr3 = mysql_query($query_sr3, $pods) or die(mysql_error());
    $row_sr3 = mysql_fetch_assoc($sr3);
    $totalRows_sr3 = mysql_num_rows($sr3);

    mysql_select_db($database_pods, $pods);
    $query_sr4 = "SELECT * FROM sr4";
    $sr4 = mysql_query($query_sr4, $pods) or die(mysql_error());
    $row_sr4 = mysql_fetch_assoc($sr4);
    $totalRows_sr4 = mysql_num_rows($sr4);

    mysql_select_db($database_pods, $pods);
    $query_sr5 = "SELECT * FROM sr5";
    $sr5 = mysql_query($query_sr5, $pods) or die(mysql_error());
    $row_sr5 = mysql_fetch_assoc($sr5);
    $totalRows_sr5 = mysql_num_rows($sr5);

    mysql_select_db($database_pods, $pods);
    $query_stx = "SELECT * FROM stx";
    $stx = mysql_query($query_stx, $pods) or die(mysql_error());
    $row_stx = mysql_fetch_assoc($stx);
    $totalRows_stx = mysql_num_rows($stx);

    mysql_select_db($database_pods, $pods);
    $query_kl = "SELECT * FROM kl";
    $kl = mysql_query($query_kl, $pods) or die(mysql_error());
    $row_kl = mysql_fetch_assoc($kl);
    $totalRows_kl = mysql_num_rows($kl);

    mysql_select_db($database_pods, $pods);
    $query_msc = "SELECT * FROM msc";
    $msc = mysql_query($query_msc, $pods) or die(mysql_error());
    $row_msc = mysql_fetch_assoc($msc);
    $totalRows_msc = mysql_num_rows($msc);

    mysql_select_db($database_pods, $pods);
    $query_total = "SELECT * FROM total_bawah";
    $total = mysql_query($query_total, $pods) or die(mysql_error());
    $row_total = mysql_fetch_assoc($total);
    $totalRows_total = mysql_num_rows($total);
  • 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-06-10T14:01:10+00:00Added an answer on June 10, 2026 at 2:01 pm

    use this SQL to copy data.

    insert into `CopyTable` (`colum1`,`colum2`) select `colum1`,`colum2` from `Sourcetable`
    

    empty table by

    TRUNCATE TABLE  `Sourcetable`
    

    example :

    $insertSQL = "INSERT INTO sr1_full (`date`, `total_pending`, `appt_today`, `percent_appt_today`, `percent_complete`, `partial_complete`, `full_complete`, `return_technical`, `return_customer`, `return_cancel`, `cancel`, `reappt`, `focus`, `total_tepi`, `total_bawah`) SELECT `date`, `total_pending`, `appt_today`, `percent_appt_today`, `percent_complete`, `partial_complete`, `full_complete`, `return_technical`, `return_customer`, `return_cancel`, `cancel`, `reappt`, `focus`, `total_tepi`, `total_bawah` FROM `sr1`";
    
    mysql_query($insertSQL); // data copied.
    
    $removeSQL = "TRUNCATE TABLE sr1";
    
    mysql_query($removeSQL); // deleted all data from sr1
    
    //data moved
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to create a product ordering and invoicing system using PHP/MySQL. I
I am looking to create a Web Chat system using PHP, MySQL and JavaScript.
I would like to create a user notification system using emails. In context it
I am currently using a PHP 5 along with Netbeans IDE to create a
I'm currently using PHP, JAVASCRIPT, MYSQL, XHTML, CSS to develop my site. Note that
I am currently using PHP/MySQL and the jQuery timeago plugin. Basically, I need to
I'm currently using the following PHP code: // Get all subordinates $subords = array();
I am currently using jQuery to load a variable php layout depending on the
I'm currently designing a web application using php, javascript, and MySQL. I'm considering two
I'm currently using Zend Framework 2 beta for on PHP 5.4.4 to develop 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.