Forum Moderators: coopster
Ive found documentation on the php interbase functions but I am not having much luck finding any sort of examples other than generic uncommented function examples from the php manual.
Anyone know of any sites that may have, commented/step by step, examples of using php with firebird, stuff like connecting and executing a query to a stored procedure etc. I want to make sure I understand what I am doing :)
Thanks in advance.
[php.net...]
h**p://www.ibphoenix.com
Have a look at the link on the left titled: What is Firebird?
It is a database originally developed by Borland, now part of the open source movement.
<edit>Remove markup that made the post look like shouting</edit>
[edited by: coopster at 7:35 pm (utc) on Jan. 21, 2004]
From a user contributed example:
$host = 'localhost:X:/firebird/examples/Employee.gdb';
$username='SYSDBA';
$password='masterkey';$dbh = ibase_connect ( $host, $username, $password ) or die ("error in db connect");
$stmt="Select * from SHOW_LANGS('SRep',4,'Italy')";
$query = ibase_prepare($stmt);
$rs=ibase_execute($query);
$row = ibase_fetch_row($rs);echo $row[0];
/* free result */
ibase_free_query($query);
ibase_free_result($rs);/* close db */
ibase_close($dbh);
?>
Just trying to understand, what appear to be, the standard variable names here: Why is the sql statement variable, named stmt? What does the 'h' stand for in dbh?
$query = ibase_prepare($stmt);
Im not sure I quite understand what the ibase_prepare function does. The php manual says "Prepare a query for later binding of parameter placeholders and execution" what exactly does that mean? Why cant you just use the sql statement($stmt) directly in the ibase_excecute function?
Thanks, Im sure I will have a few more later :)
That is just a variable that the programmer selected, it can be whatever you want.
What does the 'h' stand for in dbh?
$dbh is once again another variable name selected by the programmer. dbh is a common name for a variable used to create a "database handle". The database interface (commonly called the DBI) uses a handle to connect to the database, which in turn can be used to create handles for db commands or statements. Prior to executing statements within a database, you have to connect to the database.
OK, preparing a statement:
Databases need to parse and validate SQL statements prior to execution. Syntax as well as valid tables, permissions, etc. need to be verified. If all is well the statement handle is returned. Drivers are allowed to delay this prepare statement step until execution. Some databases just don't have any other ways of doing it.