0

i have firebird server and firebird database installed on windows server. port on this db is 8095. On this server i have installed PHP, and i need connect on this DB with php, here is my code which i tried but not success:

<?php

$host = 'localhost:D:\path\to\Database.FDB';
$username = 'user';
$password = 'pass';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM StoreCards';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
    echo $row->Code, "\n";
}
ibase_free_result($sth);
ibase_close($dbh);

?>

can you help me please?

thanks a lot

EDIT :

working with this code :

$dbh = ibase_pconnect("ipaddr:path-to-db.FDB", "user", "pass") or die('die message');
    $q = ibase_query($dbh, "select * from StoreCards");
    while ($r = ibase_fetch_object($q)) {
        $some_value = $r->CODE;
        echo $some_value;
    }

1 Answer 1

1

As long as you said the Firebird runs on a non standard 8095 port (usually it is 3050), you should specify it in ibase_connect. Something like ibase_(p)connect('host/port:path_or_alias', ... Also check if the port is accessible, no block firewall rules, etc..

So:

$host = 'localhost/8095:D:\path\to\Database.FDB';
Sign up to request clarification or add additional context in comments.

1 Comment

Also, consider to use the PDO library, it supports named parameters, easier to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.