1
Good guys, I’m starting to study about PDO, but soon in my first activity is occurring an error, follows below all the information.
CODE Object.php
<?php
$cli = new Produtos();
$cli->insert();
CODE Product.php
<?php
class Produtos extends Conexao{
public function insert(){
$this->conectar();
}
}
CODE Connected.php
class Conexao{
private static $conexao;
public function conectar(){
try{
if (!isset(self::$conexao)) {
self::$Conexao = new pdo("mysql:host=localhost; dbname = renanmeh_bd_projeto","root","")
}
}catch(PDOException $e){
echo "Erro ao conectar ao banco ".$e->getMessage;
}
return self::$conexao
}
}
Basically, this is just a test, where I have object that instantiates the product class, and this product class makes a request in the connection class.
Which error? where is the message?
– rray
You entered your password on
PDO
, or just omitted in your question?– Papa Charlie
My BD has no password, it comes with root
– Renan Rodrigues