x_wd11 Posted September 26, 2019 Share Posted September 26, 2019 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 More sharing options...
Larry Posted September 27, 2019 Share Posted September 27, 2019 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 More sharing options...
x_wd11 Posted September 27, 2019 Author Share Posted September 27, 2019 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 More sharing options...
Larry Posted September 27, 2019 Share Posted September 27, 2019 I'm not quite following your question but the most important answer is an included file can only be included once. Link to comment Share on other sites More sharing options...
x_wd11 Posted October 2, 2019 Author Share Posted October 2, 2019 Well, in your book I found the way you pass mysqli call via a function and so I am using it and it works fine. Thank you. Link to comment Share on other sites More sharing options...
Larry Posted October 4, 2019 Share Posted October 4, 2019 Awesome. Glad to hear it! Link to comment Share on other sites More sharing options...
Recommended Posts