is it possible to move one mysql table data to another table after 1 or 2 days like we have 2 table one is tbl1 another one is tbl2 tbl1 contain column uname and performance i want to move uname and performance data in to tbl2 after 2 or 3 days how t o do that

Recommended Answers

All 6 Replies

yah it is possible, but u said after one days or two days, but does not describe after one days or two days of what, means after registration, after activation or of there payment, i am assuming it can be any thing, you can do some thing like this

$day=current_date-registration_date

if($day>2)
run your query to get this informatin from table1,
run your query to insert it in the table2,
run your query to delete that value from table1,

job done its just a structure not the code, and there other complication too, unless you provide some code here, it will be very hard for others to help you out,

thanks

ok i am tring some code and back to you soon

sorry for the late response i was sick thats why can't post the code is here i am ok with this i can find the event and it work as i expected but there are also a problem a cripy problem actually that is my event name is't change ramdomly , accorrding to my code is should not be so how to change event name ramdoly any suggestion ..

$insertquery="CREATE EVENT JOY
    ON SCHEDULE  AT CURRENT_TIMESTAMP + INTERVAL 3 MINUTE
    DO
      BEGIN
       insert into course_finish (course_id, username, course_name) select username,course_name,course_id from course_entry where username = '".$user."';

delete from course_entry where username = '".$user."';
Member Avatar for diafol

Alternatively if you want to run a routine at regular intervals, you can set CRON JOBS to run a php script at a particular time / interval.

diafol it's done using rand()

Member Avatar for diafol

I have no idea what you mean. You want to run a routine at random intervals?

sorry for the late response i was sick thats why can't post the code is here i am ok with this i can find the event and it work as i expected but there are also a problem a cripy problem actually that is my event name is't change ramdomly , accorrding to my code is should not be so how to change event name ramdoly any suggestion ..

This makes little sense to me. I imagined that you wanted to run an 'archive' type routine that moved records from one table to another on a regular-ish basis.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.