Witam,
Mam 2 pytania, dlaczego funkcja error_reporting(1 lub E_ALL) nie wyświetla errora tylko jest napisane Ta strona nie działa, a drugie dlaczego funkcja showResult nie działa?
<?php
error_reporting(E_ALL);
ini_set("displays_error", 1);
class Database{
private $dbhost = "xx";
private $dbport = "3306";
private $dbuser = "xx";
private $dbpass = "xx";
private $dbase = "x";
public $conn;
public function __construct(){
if($conn == NULL){
try{
$this->conn = new PDO("mysql:host={$this->dbhost};port={$this->dbport};dbname={$this->dbname}", $this->dbuser, $this->dbpass);
} catch (Exception $exc){
echo "Error code: <b>".$exc->getCode()."</b> with message: <b>".$exc->getMessage()."</b>.";
}
}
}
public function showResult(){
$sql = "SELECT * FROM views";
$result = $this->conn->query($sql)->fetchAll(PDO::FETCH_ASSOC); //z prepare i execute tez porobowalem
print_r($result);
}
}
$eq = new Database;
$eq->showResult();
?>