Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to save data from one table to another with a delay

Participant ,
Sep 13, 2012 Sep 13, 2012

Hi,

I want to create a page that takes data from a form and insert it into a table and once its there, after maybe 1-5 minutes have certain fields copied to another table.

How can I achive this?

I will be using PHP & MySQL

TOPICS
Server side applications
955
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2012 Sep 13, 2012

Seems like a short delay where nothing much could happen.  For that short of an execution time I would say use the sleep command ( http://php.net/manual/en/function.sleep.php ).  If it is a longer time setup a cron job. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2012 Sep 13, 2012

SnakEyez02 wrote:

Seems like a short delay where nothing much could happen.  For that short of an execution time I would say use the sleep command ( http://php.net/manual/en/function.sleep.php ).

I would be very wary about using sleep() for more than a couple of seconds. I'm not sure what would happen if the same script were called again before the sleep time had expired.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2012 Sep 13, 2012

Can you give us some background as to why you want to do this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 13, 2012 Sep 13, 2012

Sure.

I want to capture all the data on the form, but not have everything in one table.

So one table is the raw data and the other is just what I need to work with, I just wanted to know if I can delay the data going into the second table

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2012 Sep 13, 2012
LATEST

The_FedEx_Guy wrote:

I want to capture all the data on the form, but not have everything in one table.

So one table is the raw data and the other is just what I need to work with, I just wanted to know if I can delay the data going into the second table

But why delay the data going into the second table? Just run two consecutive insert queries, one for the main table, the second for the table you want to work with.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines