Jump to content

[SOLVED] Mysql error: access denied for user...


Recommended Posts

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.