错误处理 - 如何捕获?

I am trying to understand this: If there are errors in the database like FK issues, Missing tables/columns, or even if the database is dead -> Will this crash the application? I have my website in php. What about application and network related errors? Can these cases be caught for and have a work around without users seeing a non functionaning site or site down message?

There are several ways to detect errors and handle them in PHP.

Exceptions, and Try-Catch statements.

Here's examples of both.

How you catch database errors will depend on what kind of database it is. If you're using MySQL, then PHP lets you catch query errors like this. Here's the doc on die and mysql_error().

mysql_query( querystuff ) or die( mysql_error() );

In general you must check every single bit of your application, from database connectivity to user input using php. That link helped me some time ago http://www.nyphp.org/PHundamentals/7_PHP-Error-Handling It introduces you to try/catch error handling.