note 61016 added to function.mysql-select-db

From: Date: Mon, 23 Jan 2006 18:53:58 +0000
Subject: note 61016 added to function.mysql-select-db
Groups: php.notes 
Request: Send a blank email to php-notes+get-102303@lists.php.net to get a copy of this message
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 ---- Server IP: 64.71.164.2 Probable Submitter: 24.73.159.66 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-select-db.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61016 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61016&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61016&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102303) next »