alicedavidson Posted April 15, 2011 Share Posted April 15, 2011 Hi again I have moved my DB and project onto my laptop, however when I run two of my pages I am getting spammed by the following... Notice: Consant_ DB_HOST already defined in c:\xampp\htdocs\p1\db_config.php on line 2 Notice: Consant_ DB_USER already defined in c:\xampp\htdocs\p1\db_config.php on line 3 Notice: Consant_ DB_NAME already defined in c:\xampp\htdocs\p1\db_config.php on line 4 Notice: Consant_ DB_PASSWORD already defined in c:\htdocs\p1\db_config.php on line 5 Notice: Consant_ DB_HOST already defined in c:\xampp\htdocs\p1\db_config.php on line 2 Notice: Consant_ DB_USER already defined in c:\xampp\htdocs\p1\db_config.php on line 3 Notice: Consant_ DB_PASSWORD already defined in c:\xampp\htdocs\p1\db_config.php on line 4 The notices are dropped in just after my include statements. This doesnt happen on my other PC and only occurs on two of my pages.The other pages work just fine. What gives? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/233833-unwanted-notices/ Share on other sites More sharing options...
alicedavidson Posted April 15, 2011 Author Share Posted April 15, 2011 DP Quote Link to comment https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202111 Share on other sites More sharing options...
PFMaBiSmAd Posted April 15, 2011 Share Posted April 15, 2011 Your code is probably including db_config.php twice. This problem probably always existed in the code but the error_reporting/display_errors settings were set to hide the problem on your first computer. You would need to debug why your code is including db_config.php more than once. Quote Link to comment https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202113 Share on other sites More sharing options...
alicedavidson Posted April 15, 2011 Author Share Posted April 15, 2011 I can't find two instances of db_config.php on any one file. Could the problem be to do with me including 3 function.php files that all all have 'require("db_config.php") inside them? If so, is there a fix or is there a way I can also disable error reporting? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202114 Share on other sites More sharing options...
PFMaBiSmAd Posted April 15, 2011 Share Posted April 15, 2011 Actually, based on the quantity of messages, you are including it 3 times, so yes that is causing the problem. You need to get the origination of your files under control. Your main file should include/require the things it needs. You should not have any need for the files being included to include (main) configuration information. Quote Link to comment https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202120 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.