Thanks!
I already used the error handling block approach you give in some crucial queries. But I don't know if it is necessary to add this below all the queries.
NogDog, for a tested live system. The problems I run into are usually due to the database connection. It is rare already. And in these incidents, most of the time, the whole database connections were down.
Only very rare cases, that some query's database connections are open and some are down. That is the reason I want to add the die() to all queries. Just to prevent that in the cases that some database connections are still running, some are not. That may cause some troubles. For example, a shopper is doing the online shopping, the product catalog, his account information are all working. But the query to get the countries information from the countries table is down. And the shopper may continue to send out his order, everything is fine. but missing the country because the countries query failed due to the database connection problem. For that reason, I am thinking about add the die() to all the queries if it is not with the error handling block. That could be done quickly rather than add full error handling block below each query.
Do we always have to add the block you gave below every query we do? or in my case, die () will be fine for most queries, only the error handling block for some crucial sql?
Or do we always have to add die() or add error_handling blocks below every query even they are fully tested for the live site (I only see the problem when database connections are half working for not die() ), as a good practice?