Based on articles that I read I made few lines that I include everywhere right before mysqli_connect:
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
error_reporting(E_ALL);
if ($admin)
{
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
}
else
{
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 1);
}
After some testing everything seems to work perfect - for admin it throws sweet, long error reports. However, for user it simply kills scripts - which is what I want, but I'd like to give some information to user, that something went wrong. I assume, that it will be an universal message, or can I customize it to tell user what went wrong? Even if not - I'd like to throw there at least some "whops" for user - but how to do that?