zend framework2 dbadapter查询语句不起作用,当使用"其中in"

时间:2015-05-18 10:05:37

标签: php mysql zend-framework

我在这里发布我的代码,我在z-ray中调试并检查mysql-command中的rawSQL。如果我第二次运行rawSQL,我可以获得拖拽行(686和687)。但它在ZF2中并不起作用。

$sql =  "select * from kd_oa_userinfo where user_id in (:user_id)";
$statement  = $this->adapter->createStatement($sql);
//first time,i set the $sqlArg = array('user_id' => "686,687") ,and z-ray print "select * from kd_oa_userinfo where user_id in ('686,687')"
//second time,i set the $sqlArg = array('user_id' => "686','687") ,and z-ray print "select * from kd_oa_userinfo where user_id in ('686','687')"

$result = $statement->execute($sqlArg);
$resultSet = new ResultSet;
$resultSet->initialize($result);
$result = $resultSet->toArray();
var_dump($result);//but the $result always be 686
exit();

0 个答案:

没有答案