siric Posted June 5, 2015 Share Posted June 5, 2015 Hello, I have the following code (which opens a database connection and then links to a table.) include("config.inc.php"); at the beginning of a script, but the file (which exists in the same directory as the script) is not being called. I have verified that the file is there and that the spelling is correct (there is no complaint for PHP not being able to read the file) Since it is not being read, the mysql search is not working. If I copy the lines from the config.inc.php file to this file, everything works. I have tried using the full directory structure to no avail. Any ideas? Thanks Steve Quote Link to comment https://forums.phpfreaks.com/topic/296656-include-not-working/ Share on other sites More sharing options...
Solution siric Posted June 5, 2015 Author Solution Share Posted June 5, 2015 Never mind. WAY too early in the morning. Config.inc.php was being called but I had an typo in the database selection string. Quote Link to comment https://forums.phpfreaks.com/topic/296656-include-not-working/#findComment-1513237 Share on other sites More sharing options...
mac_gyver Posted June 5, 2015 Share Posted June 5, 2015 your code should ALWAYS test if database statements worked or not and when they fail, display a user message (sorry this page isn't working now) and display (during development) or log (on a live server) the actual error information, and then prevent the remainder of the database dependent code from running so as to not throw follow-on errors. code that contains error checking and error reporting logic for statements that can fail, will tell you when, where, and why it has failed. Quote Link to comment https://forums.phpfreaks.com/topic/296656-include-not-working/#findComment-1513252 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.