Possible Duplicate:
PHP PDO: Can I bind an array to an IN() condition?
I am trying to do the following:
$jsonarray = json_decode($incomingData, true);
$inString = '';
$delimiter = '';
foreach($jsonarray as $jObj) {
$inString .= $delimiter.$jObj['number'];
$delimiter = "', '";
}
$inString = "'".$inString."'";
$getFriendInfo = $dbh->prepare("SELECT user_id FROM users WHERE phone_number IN (?)");
$getFriendInfo->execute(array($inString)) or die("failure");
Basically, its a group of phone numbers in a JSON array being translated into comma separated form. Then, I want to insert the "inString" into the prepared statement. I tried the manual SQL statement and it works just fine, but using a prepared statement does not. Is there a different way to get that array of numbers into the prepared statement?