Oracle OCIBindByName Problem
| From: | Lang Sharpe | Date: | Thu, 08 May 2003 01:47:26 +0000 |
| Subject: | Oracle OCIBindByName Problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27575@lists.php.net to get a copy of this message | ||
I'm trying to use bind variables in my php code. This first script works,
giving the correct result.
<php
$oradb = OCILogon('php','***','canxdata');
$custStmt = OCIParse($oradb,'SELECT co_code, cust_type, customer_flags, ' .
'email_address, user_view FROM customer ' .
'WHERE \'LANG\' = logon_id');
var_dump(OCIExecute($custStmt));
var_dump(OCIFetchInto($custStmt,$aCustRec));
var_dump($aCustRec);
?>
gives
bool(true)
int(5)
array(5) {
[0]=>
string(4) " "
[1]=>
string(6) "**** "
[2]=>
string(20) "2YYYYPA YYYYYYYYYY"
[3]=>
string(56) "lang@myself.com "
[4]=>
string(1) "9"
}
But The following script doesn't return a row;
<?php
$oradb = OCILogon('php','newplace','canxdata');
$custStmt = OCIParse($oradb,'SELECT co_code, cust_type, customer_flags, ' .
'email_address, user_view FROM customer ' .
'WHERE :logonid = logon_id');
$sLogon = 'LANG';
OCIBindByName($custStmt,':logonid',$sLogon,4);
var_dump(OCIExecute($custStmt));
var_dump(OCIFetchInto($custStmt,$aCustRec));
var_dump($aCustRec);
?>
gives
bool(true)
bool(false)
NULL
But it should work. Shouldn't it?
I've tested this on PHP 4.3.1 and 4.3.2RC2 and have had the same problem.
I'm using php on linux to talk to oracle on hpux. The linux oracle
libraries are the same version as the server(9.2.0.1.0).
Any ideas?
Lang