2015-05-12 08:34
浏览 93


Below is my query:

$key = array(1,2);
$in = join(',', array_fill(0, count($key), '?'));
$statement = $pdo->prepare("SELECT * FROM posts WHERE posts.subid IN (".$in.") AND posts.pricing=?  AND posts.Poscode=? ORDER BY posts.Poscode DESC LIMIT 60");
$result = array_merge($key, array($rate,$postcode));

When I replace $key = array(1,2); with $key = array($key); the query only fetches data for the first ID whereby I assume it converts the array into string.

$key also holds the value 1,2 in an array shown below:


foreach($a as $v=>$k) 



 $key = array($key2);

How do I make the PDO understand $key holds an array value and not a string?

1条回答 默认 最新

相关推荐 更多相似问题