model:
public function findAllGoods($order = NULL, $where = NULL, $offset = NULL, $limit = NULL) { return dibi::query( 'SELECT * FROM [shopmaster_goods]', '%if', isset($where), 'WHERE %and', isset($where) ? $where : array(), '%end', '%if', isset($order), 'ORDER BY %by', $order, '%end', '%if', isset($limit), 'LIMIT %i %end', $limit, '%if', isset($offset), 'OFFSET %i %end', $offset )->fetchAll; }
presenter:
public function renderShow(){ $goods = new Goods(); $this->template->goods=$goods->findAllGoods($order = "id", $where = (id=1), $offset = NULL, $limit=1); }
syntax error, unexpected ‚=‘
Je mi jasný, že takle se to uřčitě nemá psát, jen mě nenapadá jak… $where = (id=1)
$this->template->goods=$goods->findAllGoods("id", array("id"=>1), NULL, 1);
ORDER by id DESC se myslim zapisuje array(„id“=>„DESC“);
Dík