├── README.md ├── assets └── css │ └── style.css ├── config ├── baseConstants.php ├── constants.php └── db.php ├── controllers ├── employeeController.php └── hobbieController.php ├── index.php ├── models ├── employeeModel.php ├── helper │ └── dbConnection.php └── hobbieModel.php ├── resources └── db.sql └── views ├── employee ├── employee.php └── employeeDashboard.php ├── error └── error.php ├── hobbie ├── hobbie.php └── hobbieDashboard.php └── main └── main.php /README.md: -------------------------------------------------------------------------------- 1 | `#patterns` `#mvc` `#php` `#master-in-software-engineering` 2 | 3 | # Assembler School: PHP MVC Pattern Basics - Workshop 4 | 5 | Project using MVC Pattern without OOP. In this first approach, you will understand how the pattern works and implement it in a project created from scratch. 6 | 7 | ## Table of Contents 8 | 9 | - [Getting Started](#getting-started) 10 | - [Dependencies](#dependencies) 11 | - [Contents](#contents) 12 | - [1. Prepare the constants](#1-prepare-the-constants) 13 | - [2. Application entry point](#2-application-entry-point) 14 | - [3. Main Views](#3-main-views) 15 | - [4. Controllers](#4-controllers) 16 | - [5. Models](#5-models) 17 | - [6. Views](#6-views) 18 | - [Resources](#resources) 19 | 20 | ## Getting Started 21 | 22 | First of all, you will need to clone this repo: 23 | 24 | ```bash 25 | $ git clone https://github.com/assembler-school/repository-name 26 | ``` 27 | 28 | ## Dependencies 29 | 30 | - [Bootstrap](https://getbootstrap.com/) 31 | 32 | ## Contents 33 | 34 | When you're creating a MVC project from scratch it's very important to follow correctly the creation steps in order to understand the execution flow. That is why in this workshop we have detailed the steps to follow for a correct operation of the application: 35 | 36 | ## 1. Prepare the constants 37 | 38 | > In order to call dynamically all the CSS, JS and PHP files, we must configure our project constants that will be accessed during the execution of the application. 39 | > These files will be located in `./config/` 40 | 41 | ### 1.1. `./config/baseConstants.php` 42 | 43 | ```php 44 | FOR REFERENCE FILES 49 | define("BASE_PATH", $documentRoot); 50 | 51 | //BASE URL -> FOR LINK CSS 52 | $uri = $_SERVER['REQUEST_URI']; 53 | 54 | if (isset($uri) && $uri !== null) { 55 | $uri = substr($uri, 1); 56 | $uri = explode('/', $uri); 57 | $uri = "http://$_SERVER[HTTP_HOST]" . "/" . $uri[0]; 58 | } else { 59 | $uri = null; 60 | } 61 | 62 | define("BASE_URL", $uri); 63 | ``` 64 | 65 | ### 1.2. `./config/constants.php` 66 | 67 | ```php 68 | All the user requests must be done in the entry point, we will use query params in order to indicate which controller and function must be executed. 102 | 103 | ### 2.1. `./index.php` 104 | 105 | First of all, we need to require once the previous created constants files. 106 | 107 | ```php 108 | As you can see in the previous step, we had two default views, now we're gonna create them. 135 | 136 | ### 3.1. `./views/main/main.php` 137 | 138 | This is the main view that is loaded only if the user doesn't specify any controller or it doesn't exists. 139 | 140 | ```html 141 | 142 | 143 | 144 | 145 | 146 | 147 | Document 148 | 149 | 150 | 151 | 152 |

Welcome to MVC Pattern Basics!

153 |
154 | Employee Controller 155 | 156 | 157 | 158 | ``` 159 | 160 | ### 3.2. `./views/error/error.php` 161 | 162 | This view will be always loaded when the user specifies a bad parameter. As you can see, we print an error message that we will see in the last steps. 163 | 164 | ```html 165 | 166 | 167 | 168 | 169 | 170 | Document 171 | 172 | 173 | ". $errorMsg .""; 175 | ?> 176 | 177 | 178 | ``` 179 | 180 | ## 4. Controllers 181 | 182 | > This are the PHP files that are called in the [index.php](./index.php) file. Here we will implement the functionalities of each controller. 183 | 184 | ### `./controllers/employeeController.php` 185 | 186 | Before we start, we need to require the model, that will be responsible of calling the database queries to obtain or modify the information. We will create the model later. 187 | 188 | ```php 189 | As we said before, the models are responsible of calling the database queries to obtain or modify the information. 238 | 239 | ### 5.1. Connection to the database 240 | 241 | In order to send queries to the database, we need to create the connection. 242 | 243 | #### 5.1.1. `./models/helper/dbConnection.php` 244 | 245 | ```php 246 | PDO::ERRMODE_EXCEPTION, 258 | PDO::ATTR_EMULATE_PREPARES => FALSE, 259 | ]; 260 | 261 | $pdo = new PDO($connection, USER, PASSWORD, $options); 262 | 263 | return $pdo; 264 | } catch (PDOException $e) { 265 | require_once(VIEWS . "/error/error.php"); 266 | } 267 | } 268 | ``` 269 | 270 | ### 5.2. `./models/employeeModel.php` 271 | 272 | First, we must require the previous database connection file in order to execute the database queries. 273 | 274 | ```php 275 | require_once("helper/dbConnection.php"); 276 | ``` 277 | 278 | In this model we will create the `get` function that we are executing in the `employeeController.php`. 279 | 280 | ```php 281 | function get() 282 | { 283 | $query = conn()->prepare("SELECT e.id, e.name, e.email, g.name as 'gender', e.city, e.age, e.phone_number 284 | FROM employees e 285 | INNER JOIN genders g ON e.gender_id = g.id 286 | ORDER BY e.id ASC;"); 287 | 288 | try { 289 | $query->execute(); 290 | $employees = $query->fetchAll(); 291 | return $employees; 292 | } catch (PDOException $e) { 293 | return []; 294 | } 295 | } 296 | ``` 297 | 298 | ## 6. Views 299 | 300 | > View are the frontend part of the MVC pattern. Inside them we should create all the necessary code to show the information to the user. 301 | 302 | ### 6.1. `./views/employee/employeeDashboard.php` 303 | 304 | This will be the file that shows all the records of the database. 305 | 306 | ```php 307 | 308 | 309 | 310 | 311 | 312 | 313 | Document 314 | 315 | 316 | 317 | 318 |

Employee Dashboard page!

319 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | $employee) { 338 | echo ""; 339 | echo ""; 340 | echo ""; 341 | echo ""; 342 | echo ""; 343 | echo ""; 344 | echo ""; 345 | echo ""; 346 | echo ""; 350 | echo ""; 351 | } 352 | ?> 353 | 354 |
IDNameEmailGenderCityAgePhone NumberActions
" . $employee["id"] . "" . $employee["name"] . "" . $employee["email"] . "" . $employee["gender"] . "" . $employee["city"] . "" . $employee["age"] . "" . $employee["phone_number"] . " 347 | Edit 348 | Delete 349 |
355 | Create 356 | Back 357 | 358 | 359 | ``` 360 | 361 | ## Resources 362 | 363 | - [Readme example](https://gist.github.com/Villanuevand/6386899f70346d4580c723232524d35a) 364 | -------------------------------------------------------------------------------- /assets/css/style.css: -------------------------------------------------------------------------------- 1 | .tg-0lax .img-size{ 2 | height: 4.4rem; 3 | width: 4.4rem; 4 | } -------------------------------------------------------------------------------- /config/baseConstants.php: -------------------------------------------------------------------------------- 1 | FOR REFERENCE FILES 6 | define("BASE_PATH", $documentRoot); 7 | 8 | //BASE URL -> FOR LINK CSS 9 | $uri = $_SERVER['REQUEST_URI']; 10 | 11 | if (isset($uri) && $uri !== null) { 12 | $uri = substr($uri, 1); 13 | $uri = explode('/', $uri); 14 | $uri = "http://$_SERVER[HTTP_HOST]" . "/" . $uri[0]; 15 | } else { 16 | $uri = null; 17 | } 18 | 19 | define("BASE_URL", $uri); -------------------------------------------------------------------------------- /config/constants.php: -------------------------------------------------------------------------------- 1 | 0) { 43 | $employee = create($_POST); 44 | 45 | if ($employee[0]) { 46 | header("Location: index.php?controller=employee&action=getAllEmployees"); 47 | } else { 48 | echo $employee[1]; 49 | } 50 | } else { 51 | require_once VIEWS . "/employee/employee.php"; 52 | } 53 | } 54 | 55 | function updateEmployee($request) 56 | { 57 | $action = $request["action"]; 58 | if (sizeof($_POST) > 0) { 59 | $employee = update($_POST); 60 | 61 | if ($employee[0]) { 62 | header("Location: index.php?controller=employee&action=getAllEmployees"); 63 | } else { 64 | $employee = $_POST; 65 | $error = "The data entered is incorrect, check that there is no other employee with that email."; 66 | require_once VIEWS . "/employee/employee.php"; 67 | } 68 | } else { 69 | require_once VIEWS . "/employee/employee.php"; 70 | } 71 | } 72 | 73 | function deleteEmployee($request) 74 | { 75 | $action = $request["action"]; 76 | $employee = null; 77 | if (isset($request["id"])) { 78 | $employee = delete($request["id"]); 79 | header("Location: index.php?controller=employee&action=getAllEmployees"); 80 | } 81 | } 82 | 83 | function error($errorMsg) 84 | { 85 | require_once VIEWS . "/error/error.php"; 86 | } -------------------------------------------------------------------------------- /controllers/hobbieController.php: -------------------------------------------------------------------------------- 1 | 0) { 41 | $hobbie = create($_POST); 42 | 43 | if ($hobbie[0]) { 44 | header("Location: index.php?controller=hobbie&action=getAllHobbies"); 45 | } else { 46 | echo $hobbie[1]; 47 | } 48 | } else { 49 | require_once VIEWS . "/hobbie/hobbie.php"; 50 | } 51 | } 52 | 53 | function updateHobbie($request) 54 | { 55 | $action = $request["action"]; 56 | if (sizeof($_POST) > 0) { 57 | $hobbie = update($_POST); 58 | 59 | if ($hobbie[0]) { 60 | echo "header dashboard"; 61 | header("Location: index.php?controller=hobbie&action=getAllHobbies"); 62 | } else { 63 | $hobbie = $_POST; 64 | $error = "The data entered is incorrect, check that there is no other hobbie with that email."; 65 | require_once VIEWS . "/hobbie/hobbie.php"; 66 | } 67 | } else { 68 | require_once VIEWS . "/hobbie/hobbie.php"; 69 | } 70 | } 71 | 72 | function deleteHobbie($request) 73 | { 74 | $action = $request["action"]; 75 | $hobbie = null; 76 | if (isset($request["id"])) { 77 | $hobbie = delete($request["id"]); 78 | header("Location: index.php?controller=hobbie&action=getAllHobbies"); 79 | } 80 | } 81 | 82 | function error($errorMsg) 83 | { 84 | require_once VIEWS . "/error/error.php"; 85 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT e.id, e.name, e.email, g.name as 'gender', e.avatar, e.city, e.age, e.phone_number 8 | FROM employees e 9 | INNER JOIN genders g ON e.gender_id = g.id 10 | ORDER BY e.id ASC;"); 11 | 12 | try { 13 | $query->execute(); 14 | $employees = $query->fetchAll(); 15 | return $employees; 16 | } catch (PDOException $e) { 17 | return []; 18 | } 19 | } 20 | 21 | function getById($id) 22 | { 23 | $query = conn()->prepare("SELECT id, name, last_name, email, gender_id, avatar, age, phone_number, city, street_address, state, postal_code 24 | FROM employees e 25 | WHERE id = $id;"); 26 | 27 | try { 28 | $query->execute(); 29 | $employee = $query->fetch(); 30 | return $employee; 31 | } catch (PDOException $e) { 32 | return []; 33 | } 34 | } 35 | 36 | function create($employee) 37 | { 38 | $query = conn()->prepare("INSERT INTO employees (name, last_name, email, gender_id, city, street_address, state, age, postal_code, phone_number) 39 | VALUES 40 | (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); 41 | 42 | $query->bindParam(1, $employee["name"]); 43 | $query->bindParam(2, $employee["last_name"]); 44 | $query->bindParam(3, $employee["email"]); 45 | $query->bindParam(4, $employee["gender_id"]); 46 | $query->bindParam(5, $employee["city"]); 47 | $query->bindParam(6, $employee["street_address"]); 48 | $query->bindParam(7, $employee["state"]); 49 | $query->bindParam(8, $employee["age"]); 50 | $query->bindParam(9, $employee["postal_code"]); 51 | $query->bindParam(10, $employee["phone_number"]); 52 | 53 | try { 54 | $query->execute(); 55 | return [true]; 56 | } catch (PDOException $e) { 57 | return [false, $e]; 58 | } 59 | } 60 | 61 | function update($employee) 62 | { 63 | $query = conn()->prepare("UPDATE employees 64 | SET name = ?, last_name = ?, email = ?, gender_id = ?, city = ?, street_address = ?, state = ?, age = ?, postal_code = ?, phone_number = ? 65 | WHERE id = ?;"); 66 | 67 | $query->bindParam(1, $employee["name"]); 68 | $query->bindParam(2, $employee["last_name"]); 69 | $query->bindParam(3, $employee["email"]); 70 | $query->bindParam(4, $employee["gender_id"]); 71 | $query->bindParam(5, $employee["city"]); 72 | $query->bindParam(6, $employee["street_address"]); 73 | $query->bindParam(7, $employee["state"]); 74 | $query->bindParam(8, $employee["age"]); 75 | $query->bindParam(9, $employee["postal_code"]); 76 | $query->bindParam(10, $employee["phone_number"]); 77 | $query->bindParam(11, $employee["id"]); 78 | 79 | try { 80 | $query->execute(); 81 | return [true]; 82 | } catch (PDOException $e) { 83 | return [false, $e]; 84 | } 85 | } 86 | 87 | function delete($id) 88 | { 89 | $query = conn()->prepare("DELETE FROM employees WHERE id = ?"); 90 | $query->bindParam(1, $id); 91 | 92 | try { 93 | $query->execute(); 94 | return [true]; 95 | } catch (PDOException $e) { 96 | return [false, $e]; 97 | } 98 | } -------------------------------------------------------------------------------- /models/helper/dbConnection.php: -------------------------------------------------------------------------------- 1 | PDO::ERRMODE_EXCEPTION, 13 | PDO::ATTR_EMULATE_PREPARES => FALSE, 14 | ]; 15 | 16 | $pdo = new PDO($connection, USER, PASSWORD, $options); 17 | 18 | return $pdo; 19 | } catch (PDOException $e) { 20 | require_once(VIEWS . "/error/error.php"); 21 | } 22 | } -------------------------------------------------------------------------------- /models/hobbieModel.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT id, name, type 8 | FROM hobbies;"); 9 | 10 | try { 11 | $query->execute(); 12 | $hobbies = $query->fetchAll(); 13 | return $hobbies; 14 | } catch (PDOException $e) { 15 | return []; 16 | } 17 | } 18 | 19 | function getById($id) 20 | { 21 | $query = conn()->prepare("SELECT id, name, type 22 | FROM hobbies 23 | WHERE id = $id;"); 24 | 25 | try { 26 | $query->execute(); 27 | $hobbie = $query->fetch(); 28 | return $hobbie; 29 | } catch (PDOException $e) { 30 | return []; 31 | } 32 | } 33 | 34 | function create($hobbie) 35 | { 36 | $query = conn()->prepare("INSERT INTO hobbies (name, type) 37 | VALUES 38 | (?, ?);"); 39 | 40 | $query->bindParam(1, $hobbie["name"]); 41 | $query->bindParam(2, $hobbie["type"]); 42 | 43 | try { 44 | $query->execute(); 45 | return [true]; 46 | } catch (PDOException $e) { 47 | return [false, $e]; 48 | } 49 | } 50 | 51 | function update($hobbie) 52 | { 53 | echo "update model"; 54 | $query = conn()->prepare("UPDATE hobbies 55 | SET name = ?, type = ? 56 | WHERE id = ?;"); 57 | 58 | $query->bindParam(1, $hobbie["name"]); 59 | $query->bindParam(2, $hobbie["type"]); 60 | $query->bindParam(3, $hobbie["id"]); 61 | 62 | try { 63 | $query->execute(); 64 | return [true]; 65 | } catch (PDOException $e) { 66 | return [false, $e]; 67 | } 68 | } 69 | 70 | function delete($id) 71 | { 72 | $query = conn()->prepare("DELETE FROM hobbies WHERE id = ?"); 73 | $query->bindParam(1, $id); 74 | 75 | try { 76 | $query->execute(); 77 | return [true]; 78 | } catch (PDOException $e) { 79 | return [false, $e]; 80 | } 81 | } -------------------------------------------------------------------------------- /resources/db.sql: -------------------------------------------------------------------------------- 1 | -- Database creation 2 | DROP DATABASE IF EXISTS mvc_basics; 3 | CREATE DATABASE IF NOT EXISTS mvc_basics; 4 | USE mvc_basics; 5 | 6 | -- Creation of the tables 7 | CREATE TABLE genders( 8 | id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 9 | name VARCHAR(25) NOT NULL 10 | ); 11 | 12 | CREATE TABLE employees( 13 | id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 14 | name VARCHAR(50) NOT NULL, 15 | last_name VARCHAR(50), 16 | email VARCHAR(50) UNIQUE, 17 | gender_id INT NOT NULL, 18 | avatar VARCHAR(200), 19 | age INT(2) NULL, 20 | phone_number INT(9) NOT NULL, 21 | city VARCHAR(50), 22 | street_address VARCHAR (100), 23 | state VARCHAR(50), 24 | postal_code INT(5), 25 | FOREIGN KEY (gender_id) REFERENCES genders(id) 26 | ); 27 | 28 | CREATE TABLE hobbies( 29 | id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, 30 | name VARCHAR(50) NOT NULL, 31 | type ENUM("Indoor", "Outdoor") 32 | ); 33 | 34 | -- Insert of data 35 | INSERT INTO genders (name) 36 | VALUES 37 | ("Male"),("Female"),("Other"); 38 | 39 | INSERT INTO employees (name, last_name, email, gender_id, avatar, age, phone_number, city, street_address, state, postal_code) 40 | VALUES 41 | ("Rack", "Lei", "jackon@network.com", 1, "https://pbs.twimg.com/profile_images/587511475440332800/_Y3Wl3PL.jpg", 24, 738362767, "San Jone", "126", "CA", "39221"), 42 | ("John", "Doe", "jhondoe@foo.com", 1, "https://pbs.twimg.com/profile_images/1094979667143069696/QrD0ovrh.jpg", 34, 638362767, "New York", "126", "CA", "39221"), 43 | ("Leila", "Mills", "mills@leila.com", 2, "https://m.media-amazon.com/images/M/MV5BMzI5NDIzNTQ1Nl5BMl5BanBnXkFtZTgwMjQ0Mzc1MTE@._V1_UY256_CR4,0,172,256_AL_.jpg", 26, 638362767, "San Diego", "126", "CA", "39671"), 44 | ("Richard", "Desmond", "dismond@foo.com", 1, NULL, 30, 638362767, "New York", "126", "CA", "85716"), 45 | ("Susan", "Smith", "susanmith@baz.com", 2, NULL, 28, 638362767, "New York", "126", "CA", "09563"), 46 | ("Brad", "Simpson", "brad@foo.com", 1, NULL, 40, 638362767, "Atlanta", "126", "GEO", "01928"), 47 | ("Neil", "Walker", "walkerneil@baz.com", 1, NULL, 38, 638362767, "New York", "126", "CA", "17345"), 48 | ("Rack", "Jackon", "rack@network.com", 1, NULL, 22, 638362767, "New York", "126", "CA", "68573"), 49 | ("Homer", "Eustasio", "homer@gmail.com", 1, NULL, 34, 638362767, "New York", "126", "CA", "09857"), 50 | ("Sandra", "Foo", "sandra@foo.com", 2, NULL, 34, 638362767, "New York", "126", "CA", "09274"); 51 | 52 | INSERT INTO hobbies (name, type) 53 | VALUES 54 | ("3D Printing", "Indoor"), 55 | ("Astrology", "Indoor"), 56 | ("Karaoke", "Indoor"), 57 | ("Airsoft", "Outdoor"), 58 | ("Archery", "Outdoor"), 59 | ("Tourism", "Outdoor"); -------------------------------------------------------------------------------- /views/employee/employee.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 |
13 |

Employee's page!

14 |
15 | 16 | The employee does not exists!

"; 19 | } else if (isset($error)) { 20 | echo "

$error

"; 21 | } 22 | ?> 23 |
" method="post"> 24 | 25 |
26 |
27 |
28 | 29 | 30 |
31 | 32 |
33 |
34 |
35 | 36 | 37 |
38 |
39 |
40 | 41 |
42 |
43 |
44 | 45 | 46 | We'll never share your email with anyone else. 47 |
48 |
49 |
50 |
51 | 52 | 57 |
58 |
59 |
60 | 61 |
62 |
63 |
64 | 65 | 66 |
67 |
68 |
69 |
70 | 71 | 72 |
73 |
74 |
75 | 76 |
77 |
78 |
79 | 80 | 81 |
82 |
83 |
84 |
85 | 86 | 87 |
88 |
89 |
90 | 91 |
92 |
93 |
94 | 95 | 96 |
97 |
98 |
99 |
100 | 101 | 102 |
103 |
104 |
105 | 106 | 107 | ">Return 108 |
109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /views/employee/employeeDashboard.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 | 13 | 14 |

Employee Dashboard page!

15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | $employee) { 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | echo ""; 39 | echo ""; 40 | echo ""; 41 | echo ""; 42 | echo ""; 43 | echo ""; 44 | echo ""; 48 | echo ""; 49 | } 50 | ?> 51 | 52 |
AvatarIDNameEmailGenderCityAgePhone NumberActions
" . $employee["id"] . "" . $employee["name"] . "" . $employee["email"] . "" . $employee["gender"] . "" . $employee["city"] . "" . $employee["age"] . "" . $employee["phone_number"] . " 45 | Edit 46 | Delete 47 |
53 | Create 54 | Back 55 | 56 | 57 | -------------------------------------------------------------------------------- /views/error/error.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | ". $errorMsg .""; 11 | ?> 12 | 13 | -------------------------------------------------------------------------------- /views/hobbie/hobbie.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 |
13 |

Hobbie's page!

14 |
15 | 16 | The hobbie does not exists!

"; 19 | } else if (isset($error)) { 20 | echo "

$error

"; 21 | } 22 | ?> 23 |
" method="post"> 24 | 25 |
26 |
27 |
28 | 29 | 30 |
31 |
32 | 33 | 38 |
39 | 40 | 41 | ">Return 42 | 43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /views/hobbie/hobbieDashboard.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 |

Hobbie Dashboard page!

13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | $hobbie) { 29 | echo ""; 30 | echo ""; 31 | echo ""; 32 | echo ""; 33 | echo ""; 37 | echo ""; 38 | } 39 | ?> 40 | 41 |
IDNameTypeAction
" . $hobbie["id"] . "" . $hobbie["name"] . "" . $hobbie["type"] . " 34 | Edit 35 | Delete 36 |
42 | Create 43 | Back 44 | 45 | 46 | -------------------------------------------------------------------------------- /views/main/main.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |

Welcome to MVC Pattern Basics!

12 |
13 | Employee Controller 14 | Hobbie Controller 15 | 16 | --------------------------------------------------------------------------------