Subject | RE: [firebird-support] PHP and Firebird |
---|---|
Author | Nigel Weeks |
Post date | 2004-10-14T04:02:45Z |
There are heaps of resources on this at:
http://www.ibphoenix.com
http://www.firebirdsql.org
But to save you searching and eading, here's a simple intro:
If you've got php compiled/installed with firebird libraries, and the
firebird server running somewhere, do something like this!
Make a table with any of the tools(DBWorkBench, IBAdmin, isel, etc)
example:
create table contact (
contact_id NUMERIC(18,0) NOT NULL,
name VARCHAR(50) NOT NULL,
phone VARCHAR(15),
PRIMARY KEY(contact_id)
);
CREATE GENERATOR gen_contact_id;
Write some PHP to access it:
<?php
ibase_connect("server:/path/to/database.fdb","sysdba","masterkey");
$sql = "select * from contact order by name";
$rec = ibase_query($sql);
// Echo out the results
while($obj = ibase_fetch_object($rec)){
echo "Name:$obj->NAME, Phone:$obj->PHONE<br>";
}
?>
Too easy - just like any other database in PHP
(apart from getting inserted record ID's - use a stored procedure to do
that!)
There is a PHP specific firebird list - have a browse through the archive -
lots of good bits there!!
Nige.
http://www.ibphoenix.com
http://www.firebirdsql.org
But to save you searching and eading, here's a simple intro:
If you've got php compiled/installed with firebird libraries, and the
firebird server running somewhere, do something like this!
Make a table with any of the tools(DBWorkBench, IBAdmin, isel, etc)
example:
create table contact (
contact_id NUMERIC(18,0) NOT NULL,
name VARCHAR(50) NOT NULL,
phone VARCHAR(15),
PRIMARY KEY(contact_id)
);
CREATE GENERATOR gen_contact_id;
Write some PHP to access it:
<?php
ibase_connect("server:/path/to/database.fdb","sysdba","masterkey");
$sql = "select * from contact order by name";
$rec = ibase_query($sql);
// Echo out the results
while($obj = ibase_fetch_object($rec)){
echo "Name:$obj->NAME, Phone:$obj->PHONE<br>";
}
?>
Too easy - just like any other database in PHP
(apart from getting inserted record ID's - use a stored procedure to do
that!)
There is a PHP specific firebird list - have a browse through the archive -
lots of good bits there!!
Nige.
> -----Original Message-----
> From: kicolobo [mailto:kicolobo@...]
> Sent: Thursday, 14 October 2004 2:38 PM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] PHP and Firebird
>
>
>
>
> Hi,
> where can I learn how to use Firebird with PHP?
> By the way, is it possible?
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM
> --------------------------------------------------------------
> ------~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> __________ NOD32 1.894 (20041014) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.com
>
>