Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
foreach PHP PDO内的循环选择查询_Php_Mysql - Fatal编程技术网

foreach PHP PDO内的循环选择查询

foreach PHP PDO内的循环选择查询,php,mysql,Php,Mysql,我有数组输出,我想使用out从数据库中获取另一个输出,这是我的查询: $access_array = array(2,3,4); foreach($access_array as $val){ $index_erp = "id,name,alias,images"; $where_erp = "WHERE glb_pmstr_app_id = '2' and id = '".$val."'"; $RES_SQL = $this->S

我有数组输出,我想使用out从数据库中获取另一个输出,这是我的查询:

$access_array = array(2,3,4);

foreach($access_array as $val){
        $index_erp = "id,name,alias,images";    
        $where_erp = "WHERE glb_pmstr_app_id = '2' and id = '".$val."'";
        $RES_SQL = $this->SQL_Query->__Select($index_erp,$tbl_app_feature,null,$where_erp,null,null,SQL_FETCHALL); 
}
我应该从$RES_SQL的结果中得到3行,但我只从数据库中得到1行

如何解决这个问题

$access_array = array(2,3,4);
$output = array();

foreach($access_array as $val){
    $index_erp = "id,name,alias,images";    
    $where_erp = "WHERE glb_pmstr_app_id = '2' and id = '".$val."'";
    $RES_SQL = $this->SQL_Query->__Select($index_erp,$tbl_app_feature,null,$where_erp,null,null,SQL_FETCHALL);
    $ouput[] =  $RES_SQL;
}

这就是您要做的吗?

我没有看到任何输出数组