<?
$conn = mysql_connect("localhost", "your_username","your_password") or die(mysql_error());
mysql_select_db('your_database', $conn) or die(mysql_error());
?>

this is the code i have on database.php, when i run register page i get a erro.

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

what should i do / change?

Recommended Answers

All 5 Replies

That error means, that with the data provided

"localhost", "your_username","your_password"

you are not able to connect to a database. I do strongly think, that you specially changed the data for us not to see it, but if you really wrote

"localhost", "your_username","your_password"

then, you should use the real data, which would be able to connect you to your database. So, if

"localhost", "your_username","your_password"

is NOT the data, you are connecting with, make sure you spelled it correctly or whether such user exists on your database(if not - create one).

You need to replace 'your_username' and 'your_password' with the username and password for the MySQL database.

thanks, it's working now, i had the wrong database in. xD

cool....

PLEASE HOW DO I ADD EMAIL ADDRESS TO MY PHP TO ALLOW SUBMITTED FORM COME TO MY EMAIL? SEE CODE BELOW...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.