note 61016 rejected from function.mysql-select-db by nlopess
| From: | nlopess@php.net | Date: | Mon, 23 Jan 2006 22:03:16 +0000 |
| Subject: | note 61016 rejected from function.mysql-select-db by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102312@lists.php.net to get a copy of this message | ||
Note Submitter: nick dot bhanji at archistech dot com
----
First:
I am using centos 4.2, same problem occurs for me on fedora FC4, FC2, and also MACOSX.
mysql version 4.1.12
php 4.3.9
apache 2.0.52
here is the code:
$db_host = "localhost";
$db_user = "test";
$db_pass = "";
$db_db = "test";
$dbh = mysql_connect($db_host,$db_user,$db_pass) ||
die ("Unable to Connect to Database Server ->".mysql_errno().":"
.mysql_error());
echo $dbh;
$dbh = mysql_select_db($db_db,$dbh) ||
die ("Unable to Select Database->".mysql_errno().":" .mysql_error());
mysql_close() || die ("Unable to Close->".mysql_errno().":"
.mysql_error());
output that I get is:
1Unable to Select Database->0:
i can connect to mysql using cli
mysql -u test
output:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
I checked the error_log and the output is:
[client 127.0.0.1] PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link
resource in /home/nbhanji/Sites/Library/functions.php on line 10
I have been searching for last few days for anything that can help and I cant get anywhere. Please
HELP !!!!!!!!!!!!!!!!
Thanks in advance
Nick. Bhanji