doudang9147 2017-07-03 23:43
浏览 77

从PHP API插入MySQL数据

I am creating an API in PHP and I am stuck at a point where I need same data of one table into another.

In table one, the order ID is created by auto increment. I want to copy its order ID into the 2nd table order ID:

enter image description here

So a customer can add multiple items in same order:

enter image description here

  • 写回答

1条回答 默认 最新

  • douweng7308 2017-07-04 00:32
    关注

    I'm not sure if I understand your problem correctly. Are you asking how you can move data between two tables? Because if that's so, it's quite simple to do:

    Let's suppose you want to move a record from table foo to table bar, you can use the query:

    INSERT INTO `bar` (SELECT * FROM `foo` WHERE id = $some_id)
    

    Where $some_id is the ID of the record you want to move.

    But again, your question wasn't very clear, so apologies if this isn't what you were trying to do.

    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答