xiao Posted December 23, 2007 Share Posted December 23, 2007 Edit: SOLVED - My problem was that I used mysql_clode() in the details.php page. That was a retarded thing to do I know there's a special section for mysql problems, but I think this is PHP related and doesn't have much to do with my mysql. I get this error sometimes: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\jobs\login.php on line 12 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\jobs\login.php on line 12 On line 12, I just run $result = mysql_query("SELECT y FROM tabel WHERE x = '$x'"); I include my login.php in my header. And the login form is in my (included) navigation bar. In my header I also include my database connection, so I don't understand why it tries to login as 'ODBC'@'localhost' without a password. The database connection works fine for the rest of the website. If it helps, I used this login script: link Edit: I found out that I get this error only on 1 page: details.php But I use the same structure on every page... <?php include("header.php"); //CONTENT include("nav.php"); include("right.php"); include("footer.php"); ?> Are there some common reasons for this to occure? Link to comment https://forums.phpfreaks.com/topic/82936-solved-mysql-error-access-denied-for-user/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 23, 2007 Share Posted December 23, 2007 The error message means that there was no valid connection to a mysql server when the mysql_query() statement was executed. I would guess that your mysql_connect() function call is failing, your code has no error checking, error reporting, and error recovery logic in it and it blindly continued execution and attempted to do a mysql_query() even though the mysql_connect() failed. You would need to post your code to get any specific help with it. Link to comment https://forums.phpfreaks.com/topic/82936-solved-mysql-error-access-denied-for-user/#findComment-421812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.