第一个查询工作正常但第二个查询不更新数据库。我找不到错误。
<?php
if (isset($_GET['id'])) {
$editdes = $_GET['id'];
$con = mysqli_connect("localhost", "user", "password", "Destinos");
$con1 = mysqli_connect("localhost", "user", "password", "var");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con, "UPDATE Destinos SET Precio=730 WHERE Destino='$editdes'");
mysqli_query($con1, "UPDATE var SET variable='$editdes' WHERE variable= * ");
mysqli_close($con);
}
?>
答案 0 :(得分:3)
*
是字符串,如果用作字段的值,则应引用
UPDATE var SET variable='$editdes' WHERE variable= '*'