There are no records from the database downloaded PHP MySQL, MVC -


i have problem downloading data database , capture them view, think have foreach syntax error, can't understand that.

model/model.php

    ...     public function select($from, $select = '*', $where = null, $order = null, $limit = null) {          $query = 'select ' . $select . ' ' . $from;         if ($where != null)              $query = $query.' '.$where;         if ($order != null)              $query = $query . ' order ' . $order;         if ($limit != null)             $query = $query . ' limit ' . $limit;          $select = $this->pdo->query($query);         foreach ($select $row) {             $data[] = $row;             //var_dump($data);         }         $select->closecursor();          return $data;     } }... 

model/categoy.php

...     public function getall() {     var_dump($this->select('categories'));     return $this->select('categories'); } ... 

view/categories.php

<?php      include 'view/view.php';      class categoriesview extends view{         public function  index() {             $cat = $this->loadmodel('categories');             $this->set('catsdata', $cat->getall());             $this->render('indexcategory');         }         public function  add() {             $this->render('addcategory');         }     } 

indexcategory.html.php

    <h1>lista kategorii</h1>     <?php foreach($this->get('catsdata') $cats) { ?> <?php } ?>     <table>         <tbody>             <tr>                 <td>nazwa</td>                 <td></td>             </tr>             <tr>                 <td></td>                 <td><a href="?task=categories&action=delete&id=<?php echo $cats['id']; ?>">usun</a></td>             </tr>         </tbody>     </table> 

link problem on project - click.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -