Monday, 15 September 2014

php - How to appropriately respond when a query fails in a webapp? -



php - How to appropriately respond when a query fails in a webapp? -

half of mysqli functions homecoming false on failure. problem shooting when developing great, when released how , should used? illustration if user encounters error technical info may not relevant should removed final product? part of me afraid if script problem happened included script, confuse people , mess scalability.

if(!$link) die('can\'t connect mysql: '.mysql_error()); $db_selected = mysqli_select_db($link, 'storage1'); if(!$db_selected) die('can\'t utilize storage1: '.mysql_error());

you should never show these messages visitor / user.

instead should log error on server , display friendly message user seek 1 time again / seek 1 time again later / apologize / etc.

php sql web-applications error-handling user-experience

No comments:

Post a Comment