Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user '...'@'localhost' (using password: YES) in on line 2






     $con = mysql_connect("localhost","xyz","xyz@123"); 
    if (!$con) { die('Could not connect: ' . mysql_error());
 Print "no connect"; 
} mysql_select_db("digifivm_prosperria", $con);
     $sql="INSERT INTO digifivm_prosperria.advertise (iam, type, iwant, name, email, phoneno, query) VALUES ('$_POST[iam]','$_POST[type]','$_POST[iwant]','$_POST[name]','$_POST[email]','$_‌​POST[phoneno]','$_POST[query]')"; mysql_close($con);

I have created 2 tables i.e. enquiry & advertise in a database i.e. xyz_db. When I am submitting advertise form I have got this warning error... I have used same database, username & password in another form (enquiry)-this form is working fine..

share|improve this question
The error is quite clear, but without code we can't help – Damien Pirsy 18 hours ago
there has to be something different, inspect the files closely – DevZer0 18 hours ago
<?php $con = mysql_connect("localhost","xyz","xyz@123"); if (!$con) { die('Could not connect: ' . mysql_error()); Print "no connect"; } mysql_select_db("digifivm_prosperria", $con); $sql="INSERT INTO digifivm_prosperria.advertise (iam, type, iwant, name, email, phoneno, query) VALUES ('$_POST[iam]','$_POST[type]','$_POST[iwant]','$_POST[name]','$_POST[email]','$_‌​POST[phoneno]','$_POST[query]')"; mysql_close($con); – user1471909 18 hours ago
is your db password correct? double check it. – curious_coder 18 hours ago
@user1471909 Please add (edit) that to the post itself. – Sumurai8 18 hours ago
show 3 more comments

1 Answer

Check the mysql username, password and database name.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.