문제

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

도움이 되었습니까?

해결책

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));
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top