Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/233833-unwanted-notices/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202113
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202114
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/233833-unwanted-notices/#findComment-1202120
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.