我收到错误消息"Integrity constraint violation: 1052 Column 'restaurant_id' in where clause is ambiguous' in"
。
a) 如何在 JOIN 上使用 bindparam?这甚至是导致此错误的问题吗?
function restaurant(PDO $dbh, $username) {
global $dbh;
$stmt = $dbh->prepare("
SELECT *
FROM users u
INNER JOIN menues m
ON u.user_id = m.restaurant_id
INNER JOIN users_slider s
ON m.restaurant_id = s.restaurant_id
WHERE restaurant_id = :restaurant_id
");
$stmt->bindParam(":restaurant_id", $_GET['r']);
$stmt->execute();
return $stmt->fetchAll();
}