Вопрос

Is any way to call new mysqli($host, $user, $pass, $db_name) without printing the following errors?

Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'user'@'127.0.0.1' (using password: YES) in...

I don't like to ignore errors (@ or error_reporting(0)), i would like any other "better practice" way.

Это было полезно?

Решение

Well if you don't want errors to be printed - just tell PHP not to print them.
Configure PHP this way:

display_errors = 0
log_errors = 1

if you want to catch errors in some handler, you have to register it first.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top