Make $dbh1(database handle) available to all php files [duplicate]
问题 This question already has an answer here : Maintain $dbh (database handle) across all php files (1 answer) Closed 4 years ago . I have problem making $dbh1 available to all php files that need it for querying. I tried using "global $dbh1" in this file where querying would run. I have 4 files: testswitchDB3.php(main), testconnect.php, login.php and testnumcards.php Once database is connected as run by login.php and testconnect.php. Both files are working Thus $dbh1 is created and available by