doushang4293 2010-06-02 21:22
浏览 60
已采纳

需要帮助使用PHP在MySQL数据库之间传输数据

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:

  1. Enrollment complete: data stored in DB 'A'
  2. 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?

  • 写回答

1条回答 默认 最新

  • douyi3307 2010-06-02 21:55
    关注

    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?

    Add a WHERE clause to the SELECT * FROM?

    INSERT INTO tablename SELECT * FROM tablename2 WHERE record_id_field = 'value';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改