My connection class:
class Connection{
private $host="localhost";
private $user="root";
private $password="";
private $dbname="test";
private function conectionDB(){
$conn = new PDO("mysql:host=$this->host;dbname=$this->dbname","$this->user", "$this->password");
return $conn;
}
public function Connection(){
$this->conectionDB();
}
}
How I am performing my call in index.php:
<?php
require_once('class/Connection.class.php');
$pdo_conn = new Connection();
$query = "select * from qualquercoisa"
$pdo_statement = $pdo_conn->prepare($query);
?>
The error that presents me:
Fatal error: Uncaught Error: Call to undefined method Connection :: prepare ()