Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.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
Php sql查询如果一个tble z的where条件为true,则从下一个表以及zend框架中的同一个表中获取相关数据_Php_Zend Framework - Fatal编程技术网

Php sql查询如果一个tble z的where条件为true,则从下一个表以及zend框架中的同一个表中获取相关数据

Php sql查询如果一个tble z的where条件为true,则从下一个表以及zend框架中的同一个表中获取相关数据,php,zend-framework,Php,Zend Framework,我已经创建了两个表产品和投标。在产品表中有一列已验证。两个表都包含产品id。我需要在zend frameWork中编写一个sql查询,用于从products表中获取数据,其中验证的列值为Yes,还需要使用外键product\u id从bid表中获取相关数据。 我尝试了下面的查询。但是它只获取第一个数据,其product\u id在bid和product表中都可用 sql查询 public function fetchAllProductItems() { $oSelect = $this

我已经创建了两个表
产品
投标
。在
产品
表中有一列
已验证
。两个表都包含
产品id
。我需要在
zend frameWork
中编写一个sql查询,用于从
products
表中获取数据,其中验证的列值为
Yes
,还需要使用外键
product\u id
bid
表中获取相关数据。 我尝试了下面的查询。但是它只获取第一个数据,其
product\u id
bid
product
表中都可用

sql查询

public function fetchAllProductItems() {
    $oSelect = $this->select()
            ->setIntegrityCheck(false)
            ->from(array("p" => "products","b" => "bid"), ('*'))
            ->join(array("b" => "bid"), "b.product_id=p.product_id", array('bid_id','bid_amount'))
            ->where("p.verified = ?", "Yes");

    return $oSelect;


}   
请任何人帮我写下确切的查询。 答复是可观的