This is a problem induced by using relative filepaths. Your relative filepath worked while the file blog.php
was in the folder includes
because with ../
you were going one directory up (to your root directory) and then back inside includes
. But since you moved the file one directory up (to your root directory) you are going with ../
one directory up, outside of your root directory and then try to go into the folder includes
, but the folder doesn't exist in the directory above of your root directory (well, if you have luck it does, but the file doesn't exist or it does but the wrong one).
To prevent this you should always use absolute filepaths, that way you can move blog.php
everywhere as long as your file addbloguser.php
stays in the same location.
A easy way to get the absolute filepath to your project is to define a constant which evaluates to dirname(__FILE__))
in a global file in your project's root directory. That way you can always use the constant to do things with files and prevent to modify files to correct relative filepaths if you change something.
E.g. global.php
is inside your root directory, then you will just write this
define('IN_DIR', dirname(__FILE__)); //__FILE__ is a magic constant and includes the absolute filepath to the current file -> global.php
And if you now include in blog.php
said file global.php
(or the other way around) you can use for your filepaths the defined constant and it will look like this
require IN_DIR.'/path/to/file.php'
In this case that would be
require IN_DIR.'/includes/addbloguser.php'