dqab0824 2017-06-09 19:46
浏览 15
已采纳

动态地将值插入两个不同的数据库

I am trying to insert two values into my table using SQL: The members ID and the centre they attend. The centre table takes the Centre ID and the Members ID and links them together.

The problem is i am trying to do this via php when I add a new member (so while creating the member ID). The idea is that using the form you create the member (and an ID will be created) and add it to the members table then at the same time you insert the centre (integer) and that members ID into the Centre table

PK (auto Int)                (Linked to the members table)
CentreID         CAddress          memberID
  13                10                 1
  14                11                 2
  15                12                 3

I hope that makes some sense. I am having some trouble explaining it as i cant quite get my head around how you would do this either.

Here is a picture of my interface which is supposed to perform the operation. enter image description here

  • 写回答

1条回答 默认 最新

  • dongzheng4556 2017-06-09 19:56
    关注

    Insert into Center table then use mysql_last inert id which you can use as hidden field in the next form and then save at the time of post.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵