Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class db{
- private $dbServer = "localhost";
- private $dbUser = "root";
- private $dbPassword = "";
- private $dbName = "sql_queries";
- private $conn;
- public function __construct(){
- $this->conn = mysqli_connect($this->dbServer, $this->dbUser, $this->dbPassword) or die("Não foi possível estabelecer a conexão com a base de dados! ".mysqli_error($this->conn));
- $this->conn = mysqli_select_db($this->conn, $this->dbName) or die("Não foi possível se conectar com o banco de dados! ".mysqli_error($this->conn));
- $this->setQuery();
- }
- public function getConn(){
- return $this->conn;
- }
- public function setQuery(){
- $sql = "CREATE TABLE IF NOT EXISTS sql_queries.aluno(
- aluno_id INT NOT NULL AUTO_INCREMENT,
- nome_aluno varchar(255),
- dataNascimento_aluno date,
- nome_pai varchar(255),
- nome_mae varchar(255),
- RG_aluno char(10),
- cpf_aluno char(11),
- telefone_aluno (10)
- celular_aluno char(13),
- CONSTRAINT PK_aluno PRIMARY KEY (aluno_id);
- );";
- $result = mysqli_query($this->conn, $sql);
- }
- }
Add Comment
Please, Sign In to add comment