Firebird 2.0
PHP5 Programming
Manual

FBIRD_EXECUTE

Purpose

Use the fbird_execute funtion to execute a previously prepared query.

Syntax

<execute> ::=
   fbird_execute( qry_hndl [, <bind_params> ] )

<bind_params> ::=
     bind_arg
   | bind_arg , <bind_params>


Element 
Type
Description
qry_hndl
string
A valid query handle
bind_arg
mixed
A valid expression to bind to a parameter
<result>
mixed
A result handle or True on success, False otherwise

Semantics

Use the fbird_execute function to execute a query prepared by fbird_prepare(). This two-step approach is a lot more effective than using ibase_query() if you are repeating a same kind of query several times with only some parameters changing.

If the query raises an error, the fucntion returns False. If it is successful and there is a (possibly empty) result set (such as with a SELECT query), it returns a result handle. If the query was successful and there were no results, it returns True

Example

The below example prepares an update query and excutes it three times, using differet parameters on each invocation:

$updates = array(1001 => 'Eric', 1005 => 'Filip', 1007 => 'Larry');
$conn = fbird_connect($host, $username, $password);
$query = fbird_prepare($conn, "UPDATE STAFF SET name=? WHERE id=?");
foreach ($updates as $id => $name) {
   fbird_execute($query, $id, $name);
}



See also

fbird_prepare, fbird_query


previous page goto index next page

Legal information