Welcome Guest, Not a member yet? Register   Sign In
Site online with db offline
#6

Before you get too far along, I would recommend just trying the code in an easy-to-test location to see if it works as you expect it to.

If it does work, you might be able to get away with putting the mysqli_report() call in your index.php file, then wrapping any call to load a database in the try/catch blocks and handling the connection errors appropriately.

In general, if you're managing multiple databases, you should probably have that management code centralized in a library or model so you don't have the same code in multiple locations, but the best way to deal with this is really dependent on the structure of your application and how you are using the database connections. The important part is to make sure that you don't try to use a particular database connection if the connection fails, as you'll just generate more errors/exceptions if you try to use an invalid connection.
Reply


Messages In This Thread
Site online with db offline - by StratoKyke - 11-12-2015, 04:46 PM
RE: Site online with db offline - by mwhitney - 11-13-2015, 09:44 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 09:57 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 10:46 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:00 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 11:24 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:50 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 12:08 PM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 12:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB