"how do i use mysqli in an included file when the mysqli connection is stored in another included file?" Code Answer

4

within your content.php use require(db_conn.php); and if you have a function defined in there, you're going to have to put require(db_conn.php); inside that function.

the database connection doesn't seem to have exactly the same scoping as a standard variable.

i know when coding it, you feel like "i should only have to include this once!" but shrug get everything else working first, and if someone wants to pay you to go back and try to "fix" this... work on it then. ;)

By AlwaysWrong on March 15 2022

Answers related to “how do i use mysqli in an included file when the mysqli connection is stored in another included file?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.