I'm trying to figure out how to check for a value before inserting into the table my code currently looks like this:
try {
$stmt = $dbh->prepare("INSERT INTO test (firstname, lastname, email) VALUES (:firstname, :lastname, :email)");
$stmt->bindValue(':firstname', $first_name, PDO::PARAM_STR);
$stmt->bindValue(':lastname', $last_name, PDO::PARAM_STR);
$stmt->bindValue(':email', $email_address, PDO::PARAM_STR);
$stmt->execute();
echo 'New record created successfully';
} catch (PDOException $e) {
echo $smtp . "<br/> " . $e->getMessage();
}