我试图在插入表格之前弄清楚如何检查值,我的代码目前看起来像这样:
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();
}