Possible Duplicate:
PHP PDO: Can I bind an array to an IN() condition?
I have only made websites with PHP and MySQL for a hobby, my whole life I've always used unprepared statements until I decided to try PDO queries last night. I've successfuly gotten them all to work except when I use IN(). For Example when i do this:
$stmt3 = $dbConnection->prepare("SELECT * FROM member_search WHERE zip IN(:zip_codes_in_distance)");
$stmt3->execute(array(':zip_codes_in_distance' => $zip_codes_in_distance ));
foreach ($stmt3 as $user_list) {
//do cool stuff here
}
This returns this error:
Syntax error or access violation: 1064
After googling it, I've tried with no success a few of the solutions like using query()
instead of execute()
This only happens when I use IN()
the $zip_codes_in_distance
are zipcodes in this format '07110', '07109', '07050'
What am I doing wrong?