Hi John, Thanks. It was the $Connection VS $connection - Always the simple things ! Thanks very much for your help, John Almostgem -----Original Message----- From: php_mysql@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jftsiou Sent: Monday, October 20, 2008 1:04 PM To: php_mysql@yahoogroups.com Subject: [php_mysql] Re: PHP MySQL_Connect issues
Hi John ... Just try to not use the minus symbol "-" in database names. If you want use "_". That's from me, John --- In [EMAIL PROTECTED] <mailto:php_mysql%40yahoogroups.com> ps.com, "John" <[EMAIL PROTECTED]> wrote: > > Hi everyone, > I'm new here and am trying to resolve what should be a very simple > issue. If I try to connect to MYSQL via the command line, I have no > problem - password below = 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 55 > 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> 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) > ________________________________________ > > If I try to connect using the same data for username/password/host I > get a can't connect error. > > db_logon.php > > <?php > $db_host = 'localhost'; > $db_database = 'Soflaimages-Extras'; > $db_user = 'midnight'; > $db_password = 'cgu11b1rd'; > // echo "Variables loaded: <br />"; > ?> > > _______________________________________ > > dbtest.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()); > } > ?> > > When this run's all I get is the error message "Could not connect to > database" I was using the echo statements to debug, and get the right > information there, but it's not connecting. I also tried using the > fully qualified username of [EMAIL PROTECTED], that the seems to get > me closer - gives me a refused connection [EMAIL PROTECTED]@localhost > > Thanks everyone, I'm pulling out my hair trying to resolve this. > > Almostgem > John > > PS. Using XAAMP that I downloaded last week on Win-XP SP2 > [Non-text portions of this message have been removed]