Hi All, I'm new here and am having a problem connecting to Mysql through PHP. I've confirmed the connection through the command line and can connect, change databases, and query without issues, but when trying to connect through PHP using the same data, get error messages that I cannot connect. See below (Password is cgu11b1rd )
C:\Documents and Settings\Games>mysql -h localhost -u midnight -p Enter password: ********* Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 58 Server version: 5.0.67-community-nt MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> \u Soflaimages-Extras Database changed mysql> mysql> select Quote from photoquotes where ID = 1; +---------------------------------------------------------------+ | Quote | +---------------------------------------------------------------+ | The hardest thing in photography is to create a simple image. | +---------------------------------------------------------------+ 1 row in set (0.00 sec) __________________________________________________________________ db_logon.php <?php $db_host = 'localhost'; $db_database = 'Soflaimages-Extras'; $db_user = 'midnight'; $db_password = 'cgu11b1rd'; echo "Variables loaded: <br />"; ?> _________________________________________________________________ db_test.php <?php include('db_logon.php'); echo "$db_host, $db_user, $db_password<br />"; $Connection = mysql_connect($db_host,$db_user,$db_password); if(!$connection){ die("Could not connect to database: <br />".mysql_error()); } echo "Connected !"; $db_select=mysql_selectdb($db_database); if(!db_select) { die("Could not select the database: <br />".mysql_error()); } ?> ____________________________________________________________________ URL: http://localhost/LearningPHP-MySQL/dbtest.php REsults : Variables loaded: localhost, midnight, cgu11b1rd Could not connect to database: Thanks all ! John Almostgem