本文整理汇总了PHP中SQLite3::errorInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::errorInfo方法的具体用法?PHP SQLite3::errorInfo怎么用?PHP SQLite3::errorInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite3
的用法示例。
在下文中一共展示了SQLite3::errorInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
}
if (!$_POST['city'] || !preg_match(" /[^\$%\\^*£=~@0123456789]/ ", $_POST['city'])) {
$errCity = 'Please enter your city';
}
if (!$_POST['phone'] || !preg_match("/^[0-9]+\$/", $_POST['phone'])) {
$errPhone = 'Please enter your phone number';
}
if (!$_POST['participation']) {
$errParticipation = 'Participation statement is required';
}
// If there are no errors, send the email
if (!$errName && !$errMail && !$errStreet && !$errStreetnumber && !$errZip && !$errCity && !$errParticipation && !$errPhone) {
$db = new SQLite3('db.sqlite3');
$query = sprintf("INSERT INTO guest (lastname, firstname, mail, street, streetnumber, zip, city, phone, participation, comment) VALUES\r\n ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $lastname, $firstname, $mail, $street, $streetnumber, $zip, $city, $phone, $participation, $comment);
#echo '<p>'.$query.'</p>';
$count = $db->exec($query) or die(print_r($db->errorInfo(), true));
$db->close();
if ($count !== 0) {
$result = '<div class="alert alert-success">Guest successfully added! Reloading...</div>';
$page = $_SERVER['PHP_SELF'];
$sec = "2";
header("Refresh: {$sec}; url={$page}");
} else {
$result = '<div class="alert alert-danger">Sorry there was an error executing your query. Please try again later.</div>';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">