I am using simple method to connect to my database:
$conn = mysqli_connect($servername, $username, $password, $dbname) or die("Unable to connect to MySQL");
$conn->query("SET NAMES utf8") or die("Unable to connect to MySQL");
And its working fine, but when I directly typing wrong $servername
(or else) then i got WARNING message:-
Warning: mysqli_connect(): (28000/1045): Access denied for user 'root'@'192.168.0.157' (using password: YES) in C:\MAMP\htdocs\modul-1-froland\zaro_\admin\db_config.php on line 7
And then die message:
Unable to connect to MySQL
There is any solution to hide WARNING message, without @ and error_reporting(E_ALL)? I want to 'user friendly' error messages (like: Unable to connect to MySQL) and not the all error message (like mysqli_connect()...).