Jump to content
Larry Ullman's Book Forums

Notice: Constant DB_USER already defined


Recommended Posts

Would you tell me how to find out where this is coming from:

Notice: Constant DB_USER already defined in C:\mysqli.php on line 8

Notice: Constant DB_PASSWORD already defined in C:\mysqli.php on line 9

Notice: Constant DB_HOST already defined in C:\mysqli.php on line 10

Notice: Constant DB_NAME already defined in C:\mysqli.php on line 11

In some cases it works fine but, it does not show up but now it is showing and cannot find where it is generated. Thank  you.
 

Link to comment
Share on other sites

So, per the error message, the constants are defined in mysqli.php. When you see this error message, your script is either including that file for a second time or trying to define those constants despite the fact they're already defined in mysqli.php. 

Link to comment
Share on other sites

In a file that has several "functions" f1, f2, fn you need to put the ".../mysqli.php" call to every one of the functions, correct? Or can you have it at the top of the file and just use "mysqli_query($dbc,$x)" in each of the functions referencing mysqli? In my file it is not visible to functions if trying to set the sql connection at the top of the file. Thanks

Link to comment
Share on other sites

 Share

×
×
  • Create New...