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';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决