I am currently programming on my website and ran into a problem while trying to make a separate file for mysql server connection.
My goal is that I have that mysql connect file and I can include that wherever I need to connect to the server. The problem which occured to me was that I included that file into another file (login class file) and this login class file is also included somewhere else in the aboutme page file.
the file tree would look something like that:
aboutme.php //this file includes login_class.php
login_class.php // this file includes mysql_connect.php
login.php // this file also includes login_class.php
So the code which I used to include the mysql file looks like that:
The problem with this is that if I write it with two points at the beginning it will work for the login.php but when it has two points and you are navigating on the aboutme page it won't work since it goes back one directory too far.
So my question:
Is there a way of having an absolute path for that so it works on both pages but still having a relative root directory so I don't have to change the files whenever I wanna move the files from my localhost to the actual online server?