This code works fine, but I\'ll want to handle exception if any thing goes wrong, so I deliberately made a syntax error in the query but nothing ha
exception
query
Be sure to set the attribute PDO::ATTR_ERRMODE to PDO::ERRMODE_EXCEPTION, as soon as you init your pdo object:
$lecturers_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
After that, any failed queries will raise an exception