0
My kind of connection:
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’m making my call on index.php:
<?php
require_once('class/Connection.class.php');
$pdo_conn = new Connection();
$query = "select * from qualquercoisa"
$pdo_statement = $pdo_conn->prepare($query);
?>
The mistake you present to me:
Fatal error: Uncaught Error: Call to Undefined method Connection:()