簡體   English   中英

Zend PHP設置在查詢中與眾不同

[英]Zend php set distinct in query

如何停止使用zend查詢顯示重復值

 public function getProductCategoryById($id) {
        $where = array(
            "product_category_id = ?" => $id
        );
        $result = $this->_db_table->fetchRow($where);
//        print_r($result);die;
        if (!$result) {

            return false;
        }
        $product_category = new Application_Model_ProductCategories($result);
        return $product_category;
    }

我是zend的新用戶Iam混淆了如何在zend pls中使用不同的值看看我的代碼並進行更改

請協助

使用不同

$select = $this->select()
              ->distinct()
              ->where('product_category_id = ?', $id);

試試這個

$select = $this->select()
         ->distinct()
         ->from($this)
         ->where ('product_category_id = ?', $id);
         ->anyrestconditions()
;
$result = $this->getAdapter->fetchAll($select);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM