I am making a firebird connection through a PHP class, using the PDO, however it is experiencing a pretty sinister error in which I got lost, look at the pages, index.php / connect.php and the class.
INDEX.PHP
require("conectar.php");
$sql = "SELECT NOMCLI FROM SINAF019";
$stmt = $lokos->query($sql);
$stmt->execute();
$itens = $stmt->fetchAll(PDO::FETCH_ASSOC);
if($itens !== false)
{ foreach($itens as $row) {
echo "<span>".$row['NOMCLI']."</span>";
}
}
Connect.php
require("conectarDuosig.class.php");
$duo = new Duosig();
$duo->host = "127.0.0.1";
$duo->user = "SYSDBA";
$duo->pass = "masterkey";
$duo->dbnome = "127.0.0.1:DCOL";
$duo->conecta();
connectDuosig.class.php
class Duosig{
// variaveis para a conexão
public $host;
public $user;
public $pass;
public $dbnome;
// função para conectar
function conecta(){
$lokos=new PDO("firebird:localhost=$this->host;dbname=$this->dbnome",$this->user, $this->pass);
}
}
When I do with the class it's the error on line 21 which in the case is the
$stmt = $lokos->query($sql);
But when I make the connection pure, direct in the source code
Going and Laying
$lokos=new PDO("firebird:localhost=127.0.0.1;dbname=127.0.0.1:DCOL", $pass, $user);
and I do the select, it pulls normal.