-1
Hello, I am developing a local system here for the store where I work and I have the following problem of the title when importing data to the bank.
Follow 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);