"how to use throw exception in mysql database connect " Code Answer

5
try
{
    if ($db = mysqli_connect($hostname_db, $username_db, $password_db))
    {
        //do something
    }
    else
    {
        throw new exception('unable to connect');
    }
}
catch(exception $e)
{
    echo $e->getmessage();
}
By Anass on May 18 2022

Answers related to “how to use throw exception in mysql database connect ”

Only authorized users can answer the Search term. Please sign in first, or register a free account.