0
I’m having trouble connecting the database using PDO, use Mysql.
when executing the connection with the bank appear the following error messages:
Fatal error: Uncaught Exception 'Pdoexception' with message ' in C: wamp64 www phpCRUD config Conecta.php on line 11
Pdoexception: in C: wamp64 www phpCRUD config Conecta.php on line 11
I don’t know where I’m going wrong, someone could help me?
Follow the database configuration code:
<?php
require_once 'conf.php';
class Conecta extends conf{
var $pdo;
function __construct(){
$pdo = new PDO('mysql:host='.$this->host.':dbname='.$this->db, $this->usuario, $this->senha);
}
function login($email, $senha){
$stmt = $this->PDO->prepare("SELECT * FROM usuarios WHERE email = :email AND senha = :senha");
$stmt->bindValue(":email",$email);
$stmt->bindValue(":senha", $senha);
$exec = $stmt->execute();
$run = $stmt->fetchAll(PDO::FETCH_ASSOC);
return self::$run;
}
}
conf.php
<?php
class conf{
var $host = 'localhost';
var $usuario = 'root';
var $senha = '';
var $db = 'hoo';
}
That’s what Felipe Nascimento was. Thank you very much for your help!
– Gabriel