Oracle OCIBindByName Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux