gpt4 book ai didi

php - 如何使用左连接更新多个(5)表?

转载 作者:行者123 更新时间:2023-11-29 10:20:27 26 4
gpt4 key购买 nike

我总是在下拉选择中使用左连接,但我还不知道如何在更新时使用它。我搜索了很多,但只看到两张 table 。在三个或更多表更新中应用它时我很困惑。

请检查我的查询:

  public function updateUser($edit_id,$username)
{
$stmt=$this->conn->prepare("UPDATE tbl_login LEFT JOIN activity_logs ON tbl_login.username = activity_logs.activity_logs,
LEFT JOIN tbl_files ON tbl_login.username = tbl_files.file_uploader,
LEFT JOIN tbl_manfiles ON tbl_login.username = tbl_manfiles.file_uploader,
LEFT JOIN tbl_section ON tbl_login.username = tbl_section.creator,
LEFT JOIN tbl_adfiles ON tbl_login.username = tbl_adfiles.adfile_uploader
SET tbl_login.username=:username
WHERE id=:id");
$stmt->execute(array(":id"=>$edit_id, ":username"=>$username));

return $stmt;
}

最佳答案

$query = "UPDATE profiledata t1 JOIN profileprivacy t2 ON (t1.uid = t2.uid) 
SET t1.aboutyou = '$aboutyou', t1.quotes = '$quotes',
t2.aboutyouPrivacy = '$aboutyouPrivacy', t2.quotesPrivacy = '$quotesPrivacy'
WHERE t1.uid = '$sess_uid'";

update two tables at once

关于php - 如何使用左连接更新多个(5)表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49355145/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com