I come across this:-
PHP Error handling: die() Vs trigger_error() Vs throw Exception
and understood that throw exception is better
How can i replace die and use throw exception here in this code:-
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_db = "localhost";
$database_db = "database";
$username_db = "root";
$password_db = "password";
$db = mysqli_connect($hostname_db, $username_db, $password_db) or die("Unable to connect with Database");
?>
It is documented here http://ie2.php.net/manual/en/mysqli.error.php