JasonHarper Posted September 14, 2010 Share Posted September 14, 2010 Hello, I'm having an issue that I just can't seem to figure out. I have two include files - one that contains a function to return credentials for accessing the database and the other that generates/sends email. The issue that I'm having is that if I can change all the include_once to include, I get a fatal error that the function can't be redeclared. When I leave them as include_once, the first time the database credentials are needed, it works but subsequent calls to the function later in the code fail. I feel like I'm missing something very simple but just can't figure it out for the life of me. Thank you SO much for any help - I tried to illustrate my files/code below. Thank you! Jason Filename: access.php Purpose: Functions to provide database credentials to other functions/code function getDatabaseDetails() { //CODE IS HERE } Filename: email.php Purpose: Functions to retrieve data from DB and send email function sendEmail() { include_once '/includes/access.php' //CODE IS HERE } Filename: page.php Purpose: Actual content include_once '/includes/access.php' include_once '/includes/email.php' //CODE IS HERE Link to comment https://forums.phpfreaks.com/topic/213428-includes-issue-fatal-error-or-not-working/ Share on other sites More sharing options...
WatsonN Posted September 14, 2010 Share Posted September 14, 2010 In email.php you shouldn't need to re-include access.php unless your loading email.php instead of page.php Link to comment https://forums.phpfreaks.com/topic/213428-includes-issue-fatal-error-or-not-working/#findComment-1111181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.