├── CSS └── style.css ├── README.md ├── connection.php ├── delete_user.php ├── edit_user.php ├── index.php ├── insert_user.php ├── update.php └── users.sql /CSS/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | margin: 0; 4 | padding: 0; 5 | } 6 | 7 | html { 8 | font-family: 'Segoe UI', sans-serif; 9 | text-align: center; 10 | } 11 | 12 | a{ 13 | text-decoration: none; 14 | } 15 | 16 | .users-form form{ 17 | display: flex; 18 | flex-direction: column; 19 | gap: 24px; 20 | width: 30%; 21 | margin: 20px auto; 22 | text-align: center; 23 | } 24 | 25 | .users-form form input{ 26 | font-family: 'Segoe UI', sans-serif; 27 | } 28 | 29 | .users-form form input[type=text], 30 | .users-form form input[type=password], 31 | .users-form form input[type=email]{ 32 | padding: 8px; 33 | border:2px solid #aaa; 34 | border-radius:4px; 35 | outline:none; 36 | transition:.3s; 37 | } 38 | 39 | .users-form form input[type=text]:focus, 40 | .users-form form input[type=password]:focus, 41 | .users-form form input[type=password]:focus{ 42 | border-color:dodgerBlue; 43 | box-shadow:0 0 6px 0 dodgerBlue; 44 | } 45 | 46 | .users-form form input[type=submit]{ 47 | border: none; 48 | padding: 12px 50px; 49 | text-decoration: none; 50 | transition-duration: 0.4s; 51 | cursor: pointer; 52 | border-radius: 5px; 53 | background-color: white; 54 | color: black; 55 | border: 2px solid #60a100; 56 | } 57 | 58 | .users-form form input[type=submit]:hover { 59 | background-color: #60a100; 60 | color: white; 61 | } 62 | 63 | .users-table table{ 64 | border: 1px solid #ccc; 65 | border-collapse: collapse; 66 | margin: 0; 67 | padding: 0; 68 | width: 100%; 69 | table-layout: fixed; 70 | } 71 | 72 | table tr { 73 | background-color: #f8f8f8; 74 | border: 1px solid #ddd; 75 | padding: 4px; 76 | } 77 | 78 | table th{ 79 | padding: 16px; 80 | text-align: center; 81 | font-size: .85em; 82 | } 83 | 84 | .users-table--edit{ 85 | background: #009688; 86 | padding: 6px; 87 | color: #fff; 88 | text-align: center; 89 | font-weight: bold; 90 | } 91 | .users-table--delete{ 92 | background: #b11e1e; 93 | padding: 6px; 94 | color: #fff; 95 | text-align: center; 96 | font-weight: bold; 97 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CRUD con PHP y MySQL 🐘 2 | 3 | Este es un CRUD que creé con PHP y MySQL. 4 | Creada para el tutorial de CRUD con PHP y MySQL en mi canal de Youtube. 5 | **Mira el video haciendo click [aquí.](https://youtu.be/sYaEoNy5OGs)** 👈 6 | 7 | ## Uso 8 | Solo tienes que descargar el código, correr un server con XAMPP por ejemplo y crear la tabla usuarios con los campos (id, name, lastname, username, password, email). 9 | 10 | ## MySQL 11 | Dejaré el script de MySQL usado en el video. 12 | 13 | Sientete libre de descargar el código y modificarlo a tu antojo. Si tienes alguna duda o sugerencia, no dudes en dejar un comentario en el video. 😉 14 | 15 | ## Mis Redes Sociales 16 | Salmeron | LinkedIn 17 | Salmeron | Instagram 18 | -------------------------------------------------------------------------------- /connection.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /delete_user.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /edit_user.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Users CRUD 18 | 19 | 20 | 21 |
22 |

Crear usuario

23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 | 34 |
35 |

Usuarios registrados

36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
IDNombreApellidosUsernamePasswordEmail
EditarEliminar
64 |
65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /insert_user.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /update.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Editar usuarios 20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 | 36 | -------------------------------------------------------------------------------- /users.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.1.0 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Servidor: 127.0.0.1 6 | -- Tiempo de generación: 08-09-2022 a las 18:31:53 7 | -- Versión del servidor: 10.4.19-MariaDB 8 | -- Versión de PHP: 8.0.6 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | START TRANSACTION; 12 | SET time_zone = "+00:00"; 13 | 14 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 18 | /*!40101 SET NAMES utf8mb4 */; 19 | 20 | -- 21 | -- Base de datos: `users_crud_php` 22 | -- 23 | 24 | -- -------------------------------------------------------- 25 | 26 | -- 27 | -- Estructura de tabla para la tabla `users` 28 | -- 29 | 30 | CREATE TABLE `users` ( 31 | `id` int(11) NOT NULL, 32 | `name` varchar(20) NOT NULL, 33 | `lastname` varchar(20) NOT NULL, 34 | `username` varchar(14) NOT NULL, 35 | `password` varchar(14) NOT NULL, 36 | `email` varchar(20) NOT NULL 37 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 38 | 39 | -- 40 | -- Volcado de datos para la tabla `users` 41 | -- 42 | 43 | INSERT INTO `users` (`id`, `name`, `lastname`, `username`, `password`, `email`) VALUES 44 | (1, 'Daniel', 'Salmerón', 'salmeron_dev', '123456', 'salm@emial.com'), 45 | (5, 'Eduardo', 'Alvarado', 'daniel', '123', 'daniel@email.com'); 46 | 47 | -- 48 | -- Índices para tablas volcadas 49 | -- 50 | 51 | -- 52 | -- Indices de la tabla `users` 53 | -- 54 | ALTER TABLE `users` 55 | ADD PRIMARY KEY (`id`); 56 | 57 | -- 58 | -- AUTO_INCREMENT de las tablas volcadas 59 | -- 60 | 61 | -- 62 | -- AUTO_INCREMENT de la tabla `users` 63 | -- 64 | ALTER TABLE `users` 65 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; 66 | COMMIT; 67 | 68 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 69 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 70 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 71 | --------------------------------------------------------------------------------