dpg2905 2015-04-06 11:16
浏览 62
已采纳

使用另一个表中的值更新php MYSQL中的表

I am new to php, I am having trouble getting the right information in place, I am making a database of a social app, each user has their own user_id, I want a situation where as when they log in, and comment in the comments table the comment table grabs their user ID and puts it in the user_id of the comments table so that it is easy to identify which user commented, but all the queries I try wont work, can someone please help me?

  • 写回答

1条回答 默认 最新

  • duanjiao1256 2015-04-06 11:28
    关注

    If you want to update table from the other table, please check this out :

    UPDATE pidato SET judul=(SELECT judul FROM artikel WHERE IDArtikel=39) WHERE IDPidato=1;
    

    you can update judul column in table pidato from judul column in table artikel where IDArtikel is a 39;

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

报告相同问题?

悬赏问题

  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C