Woooops

Although I must say I will be happy to see the back of those params !


Stephen Barker wrote:
...
and assing parameters by name.
... 

you shouldn't be buggering with parameters :)

SB

  
-----Original Message-----
From: Robert martin [mailto:[email protected]] 
Sent: Wednesday, 24 June 2009 10:03 a.m.
To: NZ Borland Developers Group - Offtopic List
Subject: [DUG-Offtopic] Paramter Queries in PHP using firebird

Hi

I am a PHP newbie.

I was using PDO for other Dbs (MYSQL) but have switched to using the
firebird/interbase drivers for Firebird as the PDO firebird stuff was 
full of bugs.

Anyway I have got my php connecting, disconnecting and using
transactions ok.  However I am struggling with running 
queries that take
parameters.  In the PDO drivers I used a bindparam function 
to assign a
value to a named parameter.  However I cant see an equivelent function
for the native drivers.  I see that ibase_execute and 
ibase_Query take a
'bind_arg' list of parameters that fill in '?' indicated parameters.

First Question
I would like to do queries like "Update TableName SET Field1 =
:Field1Param WHERE Field2 = :Field2param" and assing parameters by
name.  IS this at all possible ?

If I do have to use "Update TableName SET Field1 = ? WHERE 
Field2 = ?" I
have found the following function (which I don't fully 
understand) that
takes an array of params and runs an execute.  I am using it and it
appears to work well.


function db_execute($stmt, $data)
{
    if(!is_array($data))
        return ibase_execute($stmt,$data);

    $params = array();
    while( list($k,$v) = each($data) )
        $params[$k] = '$data['.$k.']';
    eval('$rc=ibase_execute($stmt,'.join(',',$params).');');

    return $rc;
}


If I am using the above and I want to pass in Blob (binary) 
data as 1 or
more of the params I suspect the above will fail, correct?

If so what should I do?

Sorry about the long email :)

Thanks

Rob



_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to 
[email protected] with Subject: unsubscribe
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.36/2127 - Release 
Date: 06/23/09 05:54:00


    
_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with Subject: unsubscribe

  
_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to