aggiunto try catch per gestire errore in caso di connessione fallita al database
| | |
| | | $number = $_GET['number'] ?? ''; |
| | | $email = $_GET['email'] ?? ''; |
| | | |
| | | function DB_connect() { |
| | | $conn = new mysqli('127.0.0.1', 'root', ''); |
| | | if(!$conn) { |
| | | die('Connessione fallita:' . mysqli_connect_error()); |
| | | function databaseConnect() { |
| | | try { |
| | | $conn = new mysqli('127.0.0.1', 'root', ''); |
| | | } catch (Exception $e) { |
| | | die($e->getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | $error['email'] = ''; |
| | | } |
| | | |
| | | DB_connect(); |
| | | |
| | | databaseConnect(); |
| | | |
| | | |
| | | |
| | | $smarty->assign('cellNumber', $number); |
| | | $smarty->assign('email', $email); |