????.md
PHP MySql Bootstrap 4? ??? ??? CRUD
PHP??? ??? ??? ??
??
??????? ??? ???:
create table usuario( id integer primary key AUTO_INCREMENT, nome varchar(200) not null, sobrenome varchar(300) not null, idade integer not null, sexo char(1) not null )
'app/conexao' ?? ??? Conexao.php ??? ?????:
getConex?o() ?? ?? ?? ??? ?????. ??????? MySQL? ?? ?? ??????.
??? ?? ?? ???(dbname, ???, ????)? ???? ?? ?? ???.
-MySql? ??
if (!isset(self::$instance)) { self::$instance = new PDO('mysql:host=localhost;dbname=github', 'root', '', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); self::$instance->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING); } return self::$instance;
-PostgreSql? ??
$host = 'localhost;port=5432'; $dbname = 'github'; $user = 'root'; $pass = ''; try { if (!isset(self::$instance)) { self::$instance = new \PDO('pgsql:host='.$host.';dbname=' . $dbname . ';options=\'--client_encoding=UTF8\'', $user, $pass); self::$instance->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); self::$instance->setAttribute(\PDO::ATTR_ORACLE_NULLS, \PDO::NULL_EMPTY_STRING); } return self::$instance; } catch (Exception $ex) { echo $ex.'<br>'; }
???
??? ????
???: brayanmonteirooo@gmail.com
index.php
include_once "./app/conexao/Conexao.php";
include_once "./app/dao/UsuarioDAO.php";
include_once "./app/model/Usuario.php";
//??? ?????
$user = ??? ???();
$usuariodao = ??? UsuarioDAO();
?>
CRUD ?? PHP
.??,
??? {
???: #bbb !important;
}
}
???>