My code returns the following error:
Notice: Trying to get property 'message' of non-object in C:\xampp\htdocs\mysqlsample.php on line 11
What do I have to change to get it working?
<?php 
try {
    $handler = new PDO('mysql:host=127.0.0.1;dbname=group_projectdb','root','');
} catch (Exception $e) {
    echo $e->getMessage();
    die();
}
$query = $handler->query('SELECT * FROM security');
while ($r = $query->fetch()) {
    echo $r->message,'<br';
}
?>
 
     
     
     
     
     
    