Over the past month I have been working on a certificate generation system and one part I have still yet to get working is the part that probably is one of the easier parts. All I need to do is check the email that someone enters against the email of the one in the database, and if that email matches I need to print the first name. I have been reading the PHP manual and looking at other's codes with similar problems and how they fixed it but I cannot seem to get it to work. Is there anything obvious that I am doing wrong or missing that would fix this code?
<?php
$email = $_GET['email'];
$db = new PDO('mysql:host=localhost;dbname=petrzilk_cert14;charset=utf8', 'petrzilk_dbAdmin', '****************'); // Connecting to Database
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$query = $db->prepare('SELECT fname, lname, email, Date_Reg, Date_Exp FROM User_Data WHERE email = :email');
$query->bindValue(':email', $email);
//$cert = $query->fetchObject(string, 'fname'); First Attempt FAILED
//$name = $cert['fname']; First Attempt FAILED
$result = $query->fetch(PDO::FETCH_OBJ); //From what I found in the manuals online
print $result->FNAME; //This Does not Display which is what I want to display
print $email . " Hello!"; //Error checking to make sure the GET works up top. THIS DISPLAYS
?>