|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-08 17:19 UTC] chang at digitalhighway dot 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 23:00:01 2025 UTC |
$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-mysqlYou'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());