i just made user rating system using pdo for my book store project, but the comments are not based on id. how do I show the comments according to book id?
here's my code.
$query = "
SELECT review.pengguna_id, review.buku_id, review.rating, review.komentar, review.tanggal, pengguna.username
FROM review
INNER JOIN buku ON review.buku_id = buku.id
INNER JOIN pengguna ON review.pengguna_id = pengguna.id
WHERE review.buku_id = buku_id
ORDER BY review.id DESC;
";
when i use review.buku id = buku_id, it shows all comments no matter what the id.