How can I create a html table using PHP MVC

by Cracks   Last Updated April 16, 2019 02:05 AM

I am using PHP MVC with PDO. In my User model I have the following

public function selectAll(){
    $stmt = $this->_connection->prepare("SELECT * FROM users ORDER BY user_id ASC");
    return $results = $stmt->fetchAll();

I then have this in a controller

        $user= $this->model('User');

View Currently tried this but i get Undefined variable: users in F:\xampp\htdocs\app\views\users.php on line 28

                    <?php foreach ($user as $row) {


Most places I see don't use MVC and have what I have in my model directly in the view, but I don't want this.

How can I create a HTML table with MVC?

Tags : php

Related Questions