How do I select in PHP With FIREBIRD PDO?

Asked

Viewed 4,523 times

3

I have already made a correct connection with Firebird using PHP, however I would like to know how I can make one select in a certain bank. Can someone please help me?

<?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();
 }

?>
  • 1

    http://answall.com/questions/68232/usar-pdo-%C3%A9-a-more-secure-way-to-connect-a-bd-com-php already gives an idea of how to get started

1 answer

1

Do so:

$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 official documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.