Need help with transferring data between MySQL db's using PHP
Posted
by JM4
on Stack Overflow
See other posts from Stack Overflow
or by JM4
Published on 2010-06-02T21:22:01Z
Indexed on
2010/06/02
21:24 UTC
Read the original article
Hit count: 165
In one of the sites I manage, the client has decided to take on ACH/Bank Account administration where it was previously outsourced. As a result, the information submitted in our online form which used to simply store in a single database for processing now must sit in 'limbo' until the funds used for payment have been verified. My original plan is as follows:
At the end of an enrollment, all form data is collected and stored in a single MySQL database. Our internal administrator will receive an email notification reminding him enrollments have taken place. He will process the ACH information collected and wait the 3-4 business days needed for payment to clear.
Once the payment information has been returned as Good (haven't considered what I will do with the 'bad' yet), the administrator can log into a secure portal which allows him to click a button to 'process' the full information once compared and verified. the process is simplified as:
Enrollment complete: data stored in DB 'A' Funds verified and link clicked: data from 'A' is copied to DB 'B' and 'A' is deleted.
I have run similar processes with CSV output before and simply used
//transfers old data to archive
$transfer = mysql_query('INSERT INTO '.$archive.' SELECT * FROM '.$table) or die(mysql_error());
//empties existing table
$query = mysql_query('TRUNCATE TABLE '.$table) or die(mysql_error());
but in those cases, ALL data returned was copied and deleted. I only want to copy and delete a single record.
Any idea how to accomplish this?
© Stack Overflow or respective owner