This project is a simple CRUD with PHP + MySQL in this case using PDO library.
create database php2020;
use php2020;
create table amigos (
id int not null primary key auto_increment,
paterno varchar(50) not null,
materno varchar(50) not null,
nombre varchar(50) not null
);
amigo_mvc/
| index.php
--------------
| controllers/
| amigo.controller.php
--------------
| models/
| amigo.model.php
| db.php
--------------
| public/
--------------
| views/
| footer.php
| header.php
| amigo/
| amigo_edit.php
| amigo_list.php
The brains of the application that controls how data is displayed
amigo.controller.php:
In this file realized all CRUD (Create, Read, Update, Delete), for databasephp2020
.
The backend that contains all the data logic.
amigo.model.php:
In this file, realized the CRUD with connect direct to database.db.php
Connect with database for realized the CRUD.
All files with global access in this web site.
The frontend or graphical user interface (GUI)
amigo_edit.php:
Form for edit amigo.amigo_list.php:
List of amigos.
header.php:
Header of application.footer.php:
Footer of application.
index.php:
In this file, show for users the viewviews/home.php
.
To run the application, you need to have a PHP server and MySQLinstalled on your computer. Form more information:
php -S localhost:8000