Reputation: 1
how to stop to show duplicate value using zend query pls suggest
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;
}
I am new zend user Iam confuse how to use distinct value in zend pls take a look my code and do changes
Pls assist
Upvotes: 0
Views: 75
Reputation: 1753
Try with this
$select = $this->select()
->distinct()
->from($this)
->where ('product_category_id = ?', $id);
->anyrestconditions()
;
$result = $this->getAdapter->fetchAll($select);
Upvotes: 0
Reputation: 2530
Use distinct
$select = $this->select()
->distinct()
->where('product_category_id = ?', $id);
Upvotes: 1