[PHP-DB] question about
Hi; 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); 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] question about OCIBindByName(add some comment)
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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP-DB] question about OCIBindByName(add some comment)
On Mon, 21 May 2001 16:39:05 +0200 "Thies C. Arntzen" <[EMAIL PROTECTED]> wrote: > On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote: > > 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); > > have you set $email in your script (before OCIExecute)? I have set the $email before OCIParse(). Is there any problem about the varchar2 data type in bind operation? Regards; Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] about "PHP Warning: failed to rollback outstanding transactions!"
Hi; Linux 2.2.18 + oracle 8.1.7i + php 4.0.5 + oci8 I got a warning in log file. "PHP Warning: failed to rollback outstanding transactions!" I have simplify the script. it will cause the warning. function ShowError($errormsg,$dbh=false) { if($dbh!=false) OCILogOff($dbh); exit(); } $dbh=OCILogon("weboracle","cyber",""); ShowError("Login Error",$dbh); Regards; Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP-DB] question about OCIBindByName(Resolved)
Thanks for all the reply. I have resolve the problem by specified the bind type to 96(SLQT_AFC). By explore the source, the default has been set to (SQLT_CHR). as my data type is char(64), so I have to set it to 96, to get the correct result. modified source: $sql="Select count(*) From member where email=:email"; $sth=OCIParse($dbh,$sql); OCIBindByName($sth,"email",$email,64,96); // ^^ change here OCIExecute($sth); OCIFetchInto($sth,$data); Thanks. Regards; Michael On Tue, 22 May 2001 17:39:03 +0200 "Thies C. Arntzen" <[EMAIL PROTECTED]> wrote: > On Tue, May 22, 2001 at 09:41:25AM +0900, Michael Cheung wrote: > > > > On Mon, 21 May 2001 16:39:05 +0200 > > "Thies C. Arntzen" <[EMAIL PROTECTED]> wrote: > > > > > On Mon, May 21, 2001 at 11:35:36PM +0900, Michael Cheung wrote: > > > > 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); > > > > > > have you set $email in your script (before OCIExecute)? > > > > I have set the $email before OCIParse(). > > > > Is there any problem about the varchar2 data type in bind operation? > > it works for me - could you send me a _short_ but complete > testcase that reproduces your problem? > > tc > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] about "PHP Warning: failed to rollback outstanding transactions!"
Hi; Linux 2.2.18 + oracle 8.1.7i + php 4.0.5 + oci8 I got a warning in log file. "PHP Warning: failed to rollback outstanding transactions!" I have simplify the script. it will cause the warning. function ShowError($errormsg,$dbh=false) { if($dbh!=false) OCILogOff($dbh); exit(); } $dbh=OCILogon("weboracle","cyber",""); ShowError("Login Error",$dbh); Regards; Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]