question about OCIBindByName(add some comment)
| From: | Michael Cheung | Date: | Mon, 21 May 2001 14:35:36 +0000 |
| Subject: | question about OCIBindByName(add some comment) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9501@lists.php.net to get a copy of this message | ||
Hi;
Linux 2.2.18 + oracle 8.1.7i + php-4.0.5 + oci8 interface.
I use the following lines to get a result from database;
But It give me result 0, it is incorrect;
$sql="Select count(*) From member where email=:email";
$sth=OCIParse($dbh,$sql);
OCIBindByName($sth,"email",$email,64);
// with or without ':' is same, and use reference or not is also same here.
OCIExecute($sth);
OCIFetchInto($sth,$data);
but when I directly use the $email in sql, without OCIBindByName, like the
following, it give me result 5, it is correct.
$sql="Select count(*) From member where email='$email'";
$sth=OCIParse($dbh,$sql);
OCIExecute($sth);
OCIFetchInto($sth,$data);
email is char(64) in database.
where is the problem?
Thanks in advance.
Regards;
Michael