Main directory, i have staff.php. on this page i have $step=$_GET[step]; if(isset($step)) { include('staffpage/banuser.php'); } PHP: in staffpage/banuser.php the very first line i have is require ('../staff.php'); PHP: but i get error: In all logical sense this should work. I read up on it. I also commented out require and my code works fine. im missing something simple? O_O
wow what a messed up loop that gave me. i think i can figure it out from here. but why is this? I always thought if you are calling a file one directory up then use the ../page.php 2 directorys ../../page.php etc. I got something to happen. but it exploded in a loop. hrmm....i think i can fix it. but can you explain why leaving out the 2 dots seemed to work?
Not quite sure, but as far as I remember, include behaves as if the included code was written directly into the first script. So the working directory is never changed, and all paths are relative to the first script...
require and include work in the same directory. if you put a ./ you would need to put that before the quotes, but then it would be searching for a directory named staff.php
hey, whatever works. Only thing i never tried. changing require to require_once fixed the loop. issue resolved! thanks again
The include works relative to the path you are calling the script from... It is good practice to include files by their full path... Its a little more efficient this way and you wont get caught pulling your hair out (which has happened to me many times )