How can I make a select in PHP with FIREBIRD PDO?

3

I've already made a correct connection to Firebird using PHP, however I'd like to know how I can do select in a certain bank. Can anyone help me please?

<?php

$user = "SYSDBA";
$pass = "masterkey";
try{
$lokos=new PDO("firebird:localhost=ja sei 0;dbname=ja sei também",$user,$pass);
 }catch(PDOException $e) {

        echo "Falha na conexão.".$e->getcode();
 }

?>
    
asked by anonymous 01.07.2015 / 20:19

1 answer

1

Do it this way:

$user = "SYSDBA";
$pass = "masterkey";
try{
    $lokos=new PDO("firebird:localhost=ja sei 0;dbname=ja sei   também",$user,$pass);
}catch(PDOException $e) {
    echo "Falha na conexão.".$e->getcode();
}

$stmt = $lokos->prepare("select * from tabela");
$stmt->execute();
$dados = $stmt->fetchAll(PDO::FETCH_OBJ);

foreach ($dados as $row) {
   echo "{$row->nome_do_campo} <br/>";
}

?>   

For more details, read the official documentation .

    
06.07.2015 / 14:50