OK, I have a lot of PHP pages that use the following at the very beginning of the page:
But on a new page I did, I get the "Access denied for user 'root'@'localhost' (using password: NO)" message. Now, I have by "db_connect.php" function so that it is used a lot without any changes.
If I put the code from the db_connect.php function in the place of the include statement, everything is working.
So, what can be wrong with the call for the function?
Not very sure, but i think that the problem can be if you have the new file in another directory.
When you include the file which has the code above, the path to "db_connect.php" should be relative to the new file you did.
If that is the problem (you include a file that includes another php file), see this tutorial: Get Relative Path to Website Root for Includes to Access from Anywhere, maybe it helps you.
MarPlo, thanks. I looked at the tutorial and see what could have happened. Now I am going to incorporate the function from that tutorial in all my pages to make sure if I am developing something and put it in the wrong place it will get what I need from where I think it should be.
This topic is now closed. New replies are no longer allowed.