本文整理汇总了PHP中SQLite3::fetch_all方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::fetch_all方法的具体用法?PHP SQLite3::fetch_all怎么用?PHP SQLite3::fetch_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite3
的用法示例。
在下文中一共展示了SQLite3::fetch_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Replace
$pp = new pp();
$size = 6;
$rs = new SQLite3("guestbook.sdb");
//id, uid, username, reg_time, post_time, ip, ip_pos, content
if (is_array($_SESSION["user"]) && $_POST["book"]) {
$userip = ip();
$content = nl2br(stripslashes(Replace($_POST["content"])));
$query = "INSERT INTO guestbook (uid, username, reg_time, post_time, ip, content) VALUES ('{$_SESSION["user"]["id"]}', '{$_SESSION["user"]["username"]}', '{$_SESSION["user"]["time"]}', '" . time() . "', '{$userip}', '{$content}')";
$rs->query($query);
$rs->close();
echo "<script>alert('发表成功');window.location.href = 'index.php';</script>";
exit;
}
$co = $rs->fetch_line("SELECT COUNT(*) AS c FROM guestbook");
$page = $pp->show($co["c"], $size);
$list = $rs->fetch_all("SELECT id, uid, username, reg_time, post_time, ip, content FROM guestbook ORDER BY id DESC LIMIT {$pp->limit}");
$rs->close();
function Replace($str)
{
if (is_null($str)) {
return $str;
}
$word = array("<" => "<", ">" => ">", "'" => """, '"' => """);
return strtr($str, $word);
}
//获取客户端的IP
function ip()
{
if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
$onlineip = getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {