Hello, I'm developing a local system here for the store where I work and I have the following title problem when importing data to the bank.
Here are the codes:
User Class
<?php
class Usuario {
private $id;
private $nome;
private $tipo;
private $login;
private $senha;
function getId() {
return $this->id;
}
function getNome() {
return $this->nome;
}
function getTipo() {
return $this->tipo;
}
function getLogin() {
return $this->login;
}
function getSenha() {
return $this->senha;
}
function setId($id) {
$this->id = $id;
}
function setNome($nome) {
$this->nome = $nome;
}
function setTipo($tipo) {
$this->tipo = $tipo;
}
function setLogin($login) {
$this->login = $login;
}
function setSenha($senha) {
$this->senha = $senha;
}
public function cadastro ($nome, $login, $senha){
$stmt = mysqli_prepare("INSERT INTO usuario (nome, login, senha) VALUES (?,?,?)");
$stmt->bind_param($stmt, $nome, $login, $senha);
$stmt->execute();
}
}
And here's the connection to the bank:
$conn = mysqli_connect('localhost', 'root', '', 'sysloja', '3306');
if (!$conn) {
die('Could not connect to MySQL: ' . mysqli_connect_error());
}
mysqli_query($conn, 'SET NAMES \'utf8\'');
mysqli_close($conn);