Subject | Re: [firebird-support] Fb & PHP |
---|---|
Author | Gary Benade |
Post date | 2004-08-13T09:36:02Z |
>Aage Johansen wroteI use the interbase functions that ship standard with php. Simple example
> Someone wants to connect to a Firebird database (1.5) using PHP - what
> advice can I give so that he can connect succesfully?
> Is it sufficient to just install the client software (and PHP does "the
> rest")?
follows, should be enough to get you going:
function db_connect()
{
$s_database = "touchpos.gdb";
$s_user = "SYSDBA";
$s_password = "masterkey";
$s_charset = "";
$s_host = "localhost";
$s_cache = 5000;
$db_path = "d:/data/";
$s_dialect = 3;
$s_role = "";
$db_path_conn = $s_host.':'.$db_path.$s_database;
if ($dbh = ibase_connect($db_path_conn, $s_user, $s_password,
$s_charset, $s_cache, $s_dialect, $s_role))
{
return $dbh;
}
else
{
return FALSE;
}
}
$dbhandle = db_connect();
if ($dbhandle)
{
$sql = "select * from customers";
$res = ibase_query($dbhandle, $sql);
while( $row = ibase_fetch_object($res))
{
echo $row->SURNAME . "<BR>";
}
ibase_close($dbhandle);
}
Regards
Gary