I’ve got the following query:
$query = "SELECT * FROM PAS WHERE KLANT_NR = (SELECT KLANT_NR FROM klanten WHERE VOORNAAM = ? AND ACHTERNAAM = ?)";
$stmt = $mysqli->prepare($query)){
$stmt->bind_param("ss", $klantVoornaam, $klantAchternaam);
This however generates the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? AND ACHTERNAAM = ?)' at line 1
The two variables are $_POST strings..
Strange thing is, if i add two strings in the normal query instead of the ‘?’s, the query works fine. I can’t figure out why the prepared statement doesn’t work then…
I found the awnser myself, it was related to an other $query i placed below..
stupid mistake, thanks for the help though.