Bug #15458 Updated: mysql_pconnect return boolean
| From: | chang at digitalhighway dot net | Date: | Fri, 08 Feb 2002 23:02:59 +0000 |
| Subject: | Bug #15458 Updated: mysql_pconnect return boolean | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-79780@lists.php.net to get a copy of this message | ||
ID: 15458
Updated by: chang@digitalhighway.net
Reported By: chang@digitalhighway.net
Status: Bogus
Bug Type: MySQL related
Operating System: Solaris 8
PHP Version: 4.1.1
New Comment:
Thanks for the help and fast reply.
Previous Comments:
------------------------------------------------------------------------
[2002-02-08 17:53:49] mfischer@php.net
You've been caught by 'Operator Precedence'.
First, the evaluation of the '||' operator is done. Since you can
successfully connect (and a resource is a logical true), the statement
'opa || opb' gives 'true' then this is assigned to $con.
For what you want to do, you need to set parenthesis properly:
($con = mysql_pconnect($db_Hostname, $db_UserName, $db_Password) ||
die("Can't Connect to Database: ".mysql_error());
------------------------------------------------------------------------
[2002-02-08 17:24:03] chang@digitalhighway.net
Sorry forgot to mention, platform is Sparc. And the error also applies
for mysql_connect.
------------------------------------------------------------------------
[2002-02-08 17:22:38] chang@digitalhighway.net
$con = mysql_connect($db_Hostname, $db_UserName, $db_Password) ||
die("Can't Connect to Database: ".mysql_error());
print gettype($con);
print $con;
The connection is okay, no error is given. PHP generates an error if
the
username or password is incorrect.
Variable $con supposed to be a link, but instead its a boolean with
the
value true(1). Just for info, other php scripts work fine in
conjuction
with mysql. but for this script I need to have seperate links, instead
of de default last one.
Compile options: --with-mysql
------------------------------------------------------------------------
[2002-02-08 17:19:27] chang@digitalhighway.net
$con = mysql_pconnect($db_Hostname, $db_UserName, $db_Password) ||
die("Can't Connect to Database: ".mysql_error());
print gettype($con);
print $con;
The connection is okay, no error is given. PHP generates an error if
the username or password is incorrect.
Variable $con supposed to be a link, but instead its a boolean with the
value true(1). Just for info, other php scripts work fine in conjuction
with mysql. but for this script I need to have seperate links, instead
of de default last one.
Compile options: --with-mysql
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15458&edit=1