View Full Version : PHP Login Script QUESTION

05-18-2008, 07:02 PM


* Connect to the mysql database.
$conn = mysql_connect("localhost", "my_username", "my_password") or die(mysql_error());
mysql_select_db('my_database', $conn) or die(mysql_error());


This isn't working. (I have put things like "my_username" because i don't want to put my details)

It comes up with:

PHP Error Message

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a8546868'@'localhost' (using password: YES) in /home/a8546868/public_html/database.php on line 6

Free Web Hosting
Access denied for user 'a8546868'@'localhost' (using password: YES)

That is what comes up. Does anyone know what is happening?

Thank You

05-18-2008, 07:19 PM
you have the wrong username or password

05-18-2008, 07:24 PM
no i don't... That is the problem...

05-18-2008, 07:29 PM
Well that's the error you get when a username and password don't match up.

Just to verify: I copied pasted your script with my own database details and it worked fine.

05-18-2008, 07:36 PM
Hmm... I wonder what has happened...

With the database name, did you pt the whole database name up or did you just put the actual table name?

05-18-2008, 07:45 PM
For the mysql_select_db(); you put the database name, not the table name. Is your username/password in the correct case? Are you using the correct host? Usually it is "localhost" online.

05-18-2008, 07:48 PM
I think i have done it, because it is not localhost for mine, it is something else and i was using localhost, so i will say *RESOLVED* in the next post of mine if it has worked...