Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
x_wd11

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.
 

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I'm not quite following your question but the most important answer is an included file can only be included once.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...