Question

I have connected to firebird DB with interbase.so.

On manual page http://www.php.net/manual/en/function.ibase-execute.php there is an example:

<?php
function db_execute($stmt,$data)
{
    if(!is_array($data))
        return ibase_execute($stmt,$data);
    array_unshift($data,$stmt);
    $rc=call_user_func_array('ibase_execute',$data);
    return $rc;
}
?>

How to prepare query with named parameters and bind these parameters with values? eg. here http://www.php.net/manual/en/pdo.prepare.php#example-1004

Was it helpful?

Solution

You need to use Firebird pdo driver and the named parameters example should work , here is one example

$query = 'INSERT INTO testuser (ID, NAME, ADDRESS, COMPANY) VALUES (:ID, :NAME, :ADDRESS, :COMPANY)';
$stmt = $db->prepare($query);
$values = array(
    ':ID'      => 2,
    ':NAME'    => 'user2',
    ':ADDRESS' => 'address2',
    ':COMPANY' => 'company2'
);
if ($stmt->execute($values) === false) {
    var_dump($db->errorInfo());
} else {
    print_r($db->query('SELECT * FROM testuser')->fetchAll(PDO::FETCH_ASSOC));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top