开发者

"Access denied" error talking to MySQL

开发者 https://www.devze.com 2023-03-30 01:38 出处:网络
I am getting this warning on line 25: Warning : Warning: mysql_query() [function.mysql-query]: Access denied for user \'ODBC\'@\'localhost\' >(using password: NO) in C:\\xampp\\htdocs\\shadaab\\re

I am getting this warning on line 25:

Warning :

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' >(using password: NO) in C:\xampp\htdocs\shadaab\register.php on line 25

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs开发者_Python百科\shadaab\register.php on line 25 Access denied for user 'ODBC'@'localhost' (using password: NO)"

I have following SQL query on line 25:

$result=mysql_query("SELECT email FROM user WHERE email='$email'")or die(mysql_error());


The error message means:

  • You have not connected to database (using mysql_connect and mysql_select_db)
  • If you have specified mysql_connect, you are not specifying correct username and password to the mysql_connect function.

Here is how you can connect to your db before running your SQL queries:

$con = mysql_connect('server address', 'username', 'password') or die(mysql_error());
mysql_select_db('your db name') or die(mysql_error());

More information on official documentation.


It seems that you provide invalid data in mysql_connect. Check user/password.


Looks like a connection problem, check that you are calling mysql_connect above that line, and that your settings (password, host name, database name) and permissions are correct. Docs

0

精彩评论

暂无评论...
验证码 换一张
取 消