What's the best practice for returning error messages to a client from a server-side script that is accessing a database?
For example, say the client sends from data using an AJAX POST and expects the server to return some JSON data to display. What if the PHP server script fails to connect to the database (I'm using mysqli_connect() )? Must I send back explicit JSON data with an error message? Or can I make use of the status object in the client-side POST callback function?