The problem is with your php. Just as a test, print $db_host,$db_user,$db_pass in your function before you try the connect. My guess is that they will be blank. The reason for this is that you assign them outside of the function. This means you either need to pass them to the function or explicitly state that they are global. Since these are all blank, it is using the defaults, which on windows are localhost, ODBC, and no password.
--- Tom Crimmins Interface Specialist Pottawattamie County, Iowa -----Original Message----- From: Christian Biggins Sent: Wednesday, January 26, 2005 7:30 AM Subject: RE: Access denied for user - I cant work this out Hi Peter, There is a password being suppled - see code (btw, its local testing only, hence the root user) //Database Settings $db_host = 'localhost'; //database hostname $db_name = 'powerpla_powerplay'; //database name $db_user = 'root'; //database USER name $db_pass = 'rootpass'; // database password function db_connect() { if ($dbc = @mysql_connect($db_host, $db_user, $db_pass)) { if (!mysql_select_db($db_name)) { die('<p>Could not connect to the database because: <b>' . mysql_error() . '</b></p>'); } } else { die('<p>Could not connect to the database because: <b>' . mysql_error() . '</b></p>'); } } -----Original Message----- From: Peter Lovatt Sent: Thursday, 27 January 2005 12:27 AM To: Christian Biggins; mysql@lists.mysql.com Subject: RE: Access denied for user - I cant work this out hi you are not passing a password to mysql - check your code to see if this is correct. Peter > -----Original Message----- > From: Christian Biggins > Sent: 26 January 2005 12:27 > To: mysql@lists.mysql.com > Subject: Access denied for user - I cant work this out > > > Hi All, > > I am consistently getting; > > Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) > > I am connecting through php with the same script I use all the time, I > have checked it and dbl checked it for problems. > > I can connect to mysql in a prompt and I have added new users with all > priv's and connected with them - obviously its more a server issue > than mysql (I think)... > > MySQL version is 4.0.21 > PHP Version 4.3.8 > On a Win2k server using apache 2 (just a local testing server). > > Any info would be muchly appreciated. > > Christian > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]