sql - How to do two SELECTs with GROUP BY in a PHP MVC framework? -


i'm starting work mvc , have old project i'm transforming mvc. in 1 of file view pages has select group year , select = 'year' display year files, can explain me how in mvc?

//controler public function files() {     $model = new mymodel();      $year = $model->readgroup("*", "status='1'", "year", "id desc");      $data["response"] = $year;     $this->service->render('project/page.phtml',$data);  }  //model public function readgroup($fields = "*",$where=null, $group=null, $orderby=null){     $where_sql = empty($where) ? "": "where ".$where;     $group_sql = empty($group) ? "": "group ".$group;     $orderby_sql = empty($orderby) ? "": "order ".$orderby;      $r = $this->_pdo->prepare("select {$fields} $this->table {$where_sql} {$group_sql} {$orderby_sql}");     $r->execute();      return $r->fetchall(); } 

i have structure , question how use "$year" select or way this.

thanks


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -