38175425 Posted September 20, 2021 Share Posted September 20, 2021 In the php file "create", you can see "include('../db.php');" in line 3. You can see the file "db.php" in here But here you can see the codes don't work: here's the full "create.php" codes Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 20, 2021 Share Posted September 20, 2021 You are asking to include a filename of db.php in a folder above your current one. Yet - you are showing us the contents of your root folder. Isn't the db.php supposed to be one higher? Quote Link to comment Share on other sites More sharing options...
Barand Posted September 20, 2021 Share Posted September 20, 2021 (edited) An earlier post of yours shows you apparently disapprove of people posting solutions, so why should we? Edited September 20, 2021 by Barand Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 20, 2021 Share Posted September 20, 2021 PS You posted a line: Posted 31 minutes ago In the php file "create", you can see "include('../db.php');" in line 3. You can see the file "db.php" in here But I don't see the todo folder in there Quote Link to comment Share on other sites More sharing options...
38175425 Posted September 20, 2021 Author Share Posted September 20, 2021 45 minutes ago, Barand said: An earlier post of yours shows you apparently disapprove of people posting solutions, so why should we? I didn't read the reply I'm sorry Quote Link to comment Share on other sites More sharing options...
38175425 Posted September 20, 2021 Author Share Posted September 20, 2021 1 hour ago, ginerjm said: PS You posted a line: Posted 31 minutes ago In the php file "create", you can see "include('../db.php');" in line 3. You can see the file "db.php" in here But I don't see the todo folder in there If I put the file "db.php" in the folder "public_html", then the codes would work. But I want the file "db.php" to be in the folder "todolist_demo". Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 20, 2021 Share Posted September 20, 2021 That is not the same folder as you showed us earlier. I quit. You are not AT ALL helpful. Quote Link to comment Share on other sites More sharing options...
38175425 Posted September 20, 2021 Author Share Posted September 20, 2021 14 minutes ago, ginerjm said: That is not the same folder as you showed us earlier. I quit. You are not AT ALL helpful. Sorry, I mean the codes would work if I moved the file "db.php" from the folder "todolist_demo" to "public_html". Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 20, 2021 Share Posted September 20, 2021 (edited) Whatever that means. Perhaps you should work on your communication instead of your programming. Personally you should probably place sensitive php modules ABOVE your root folder where idle hackers have a bit harder time getting to. Now (if you are showing is the right place) you seem to have this stuff inside your web root folder - not good. And perhaps use an absolute path to avoid future confusion with your scripts. Edited September 20, 2021 by ginerjm Quote Link to comment Share on other sites More sharing options...
Solution cyberRobot Posted September 20, 2021 Solution Share Posted September 20, 2021 (edited) If I'm reading everything correct, the "create" script is under todolist_demo > public_html > todo. The "create" script isn't able to find your db.php because the following line only goes up one level. include('../db.php'); Basically, you're telling "create" that db.php is in your public_html folder. You either need to use "../../db.php". Or I would actually recommend switching that line so it starts at the document root. I'm guessing "public_html" is your root folder. If that's the case, you could try the following: include $_SERVER['DOCUMENT_ROOT'] . '/../db.php'; Edited September 20, 2021 by cyberRobot Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 20, 2021 Share Posted September 20, 2021 And if you are really going to be a programmer you should enable the filename extensions in your windows install. Makes it easier to tell one file from another when it has an .html or .php or a .js or a .inc on it. 1 Quote Link to comment Share on other sites More sharing options...
38175425 Posted September 21, 2021 Author Share Posted September 21, 2021 11 hours ago, cyberRobot said: If I'm reading everything correct, the "create" script is under todolist_demo > public_html > todo. The "create" script isn't able to find your db.php because the following line only goes up one level. include('../db.php'); Basically, you're telling "create" that db.php is in your public_html folder. You either need to use "../../db.php". Or I would actually recommend switching that line so it starts at the document root. I'm guessing "public_html" is your root folder. If that's the case, you could try the following: include $_SERVER['DOCUMENT_ROOT'] . '/../db.php'; problem solved thank you! Quote Link to comment Share on other sites More sharing options...
38175425 Posted September 21, 2021 Author Share Posted September 21, 2021 8 hours ago, ginerjm said: And if you are really going to be a programmer you should enable the filename extensions in your windows install. Makes it easier to tell one file from another when it has an .html or .php or a .js or a .inc on it. Thanks for the tip! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.