gpt4 book ai didi

Mysql更新两个表不工作

转载 作者:行者123 更新时间:2023-11-28 23:52:40 25 4
gpt4 key购买 nike

解决方案 - 在表单标签的 action 属性中包含 get 变量。问题是调用主键,我试过 $id = $_GET['ID'];它失败了。使用 $id = 1 并且效果很好。我试过 $id = (isset($_GET['ID']));也失败了。成功了,谢谢大家

  <?php

include 'Includes/conDB.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$unoone = $_POST['stringone'];
$unotwo = $_POST['stringtwo'];
$unothree = $_POST['integerthree'];
$unofour = $_POST['stringfour'];

// a data path for images
$valuz_ins = explode(',', $valuz_ins);

$id = $_GET['ID'];

$result = "UPDATE T1 LEFT JOIN T2
ON (T1.ID=T2.ID) SET T1.stringone=?,

T1.stringtwo=?, T1.integerthree=?, T1.stringfour=?,
T2.imge1=?, T2.imge2=?, T2.imge3=?, T2.imge4=?
WHERE T1ID=?";

// prepare and bind

$stmt = mysqli_prepare($con,$result);

mysqli_stmt_bind_param($stmt,'ssisssssi', $unoone, $unotwo,

$unothree, $unofour, $valuz_ins[0], $valuz_ins[1], $valuz_ins[2],
$valuz_ins[3], $id);

/* execute prepared statement */
mysqli_stmt_execute($stmt);


printf("%d Record updated.\n", mysqli_stmt_affected_rows($stmt));


}
/* close statement and connection */
mysqli_stmt_close($stmt);

mysqli_close($con);

?>

最佳答案

我想你错过了 T1.ID = T2.ID,请尝试下面的一个

UPDATE T1 LEFT JOIN T2
ON (T1.ID=T2.ID) SET T1.stringone=?,

T1.stringtwo=?, T1.integerthree=?, T1.stringfour=?,
T2.imge1=?, T2.imge2=?, T2.imge3=?, T2.imge4=?
WHERE T1.ID=?

关于Mysql更新两个表不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32389542/

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