Access denied for user 'blue'@'localhost' (using password: YES)

Hello,

I know very little about programming, means what ever learn, i learnt it from the you tube, so in order to explain my problem i am writing every thing so when i get the reply i can understand it.

first i try to download apache, mysql and phpmyadminn but did not succed.

after that i downloaded XAMPP 1.7.7

In XAMPP 1.7.7 I gave this information for my security

MYSQL SECTION: “ROOT” PASSWORD (This line was already there as a heading)

MYSQL super user : root (it was already there so i cant change)
password : bluebus
PhpMyAdmin authentification: http or cokie (i select cokie),
Safe plain password in text file? ((File: C:\xampp\security\security\mysqlrootpasswd.txt): there was a check box i did not click,

XAMPP DIRECTORY PROTECTION (.htaccess) (this line was already there as a heading)

User: bus
Password : bluebuss,
Safe plain password in text file? ((File: C:\xampp\security\security\mysqlrootpasswd.txt): there was a check box i did not click,

after that i went to phpmyadmin

user : root
password: redbus

after this i created a database, DATABASE NAME: CAR,

After this i added a new user for this database, NEW USER NAME: CAR, and password i gave again “redbus”, and i created a table,

after this i created a new file in notpad++, the coding is

  1. <?php

  2. define (‘DB_NAME’, ‘car’);

  3. define (‘DB_USER’, ‘car’);

  4. define (‘DB_PASWORD’, ‘redbus’);

  5. define (‘DB_HOST’, ‘localhost’);

  6. $link= mysql_connect (DB_HOST,DB_USER,DB_PASSWORD);

  7. if (!$link) {

  8. die (‘could not connect:’ . mysql_error () );

  9. }

  10. $db_selected=mysql_selected_db (DB_NAME, $link);

  11. if (!$db_selected) {

  12. die (‘cant user’ . ‘:’ . mysql_error ());

  13. }

  14. $value = $_post [‘input1’];

  15. $sql= “INSERT INTO demo (input1) VALUES (‘$value’)”;

  16. if (!mysql_query ($sql)) {

  17. die (‘error:’ . mysql_error () );

  18. }

  19. mysql_close ();

  20. ?>

when i try to run it its give me this error and i dont understand why

Notice: Use of undefined constant DB_PASSWORD - assumed ‘DB_PASSWORD’ in C:\xampp\htdocs\PhpProject1\index.php on line 8

[Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘car’@‘localhost’ (using password: YES) in C:\xampp\htdocs\PhpProject1\index.php on line 8
could not connect:Access denied for user ‘malakiarif’@‘localhost’ (using password: YES)

please help me guys, i try to found out the answer by googling and wasted my whole week but could not find answer, please help me and tell me what i need to correct.

thanks

For a start you are using PASSWORD on line 8 and PASWORD on line 5.

thanks i corrected it, but its still showing me the same error,

or i am doing some other mistake. after your message i check my other spelling mistake as well,

thanks

help please

and one more thing after correcting my spelling mistake it is only showing one error, so thanks for your help, the error which its showing is

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘arif’@‘localhost’ (using password: YES) in C:\xampp\htdocs\PhpProject1\index.php on line 8
could not connect:Access denied for user ‘arif’@‘localhost’ (using password: YES)

thanks

i think i was doing some stupid mistake so this time i added a new user name: member, password: redblue and changed the coding accordingly on line 4 and and five now its look like …
line 4. define (‘DB_USER’, ‘member’);
line5. define (‘DB_PASSWORD’, ‘redblue’);
but after running it is giving me the error Fatal Error: Call to undefined function mysql_selected_db() in C:\xampp\htdocs\PhpProject1\index.php on line 14
line 14 is
$db_selected=mysql_selected_db (DB_NAME, $link);
thanks for help

Try changing $db_selected=mysql_selected_db (DB_NAME, $link); to $db_selected=mysql_select_db (DB_NAME, $link);

thanks i changed and now its showing no error, you are a great person, i wasted at least a week on these errors and you solved it in two messeges,

thanks for your help