$page = $_GET['page'];
$dsn = "mysql:host=localhost;dbname=bbv1";
$db = new PDO($dsn,'root',''); //pdo链接
$num = 10; //每页显示的文章数目
$pagea=($page-1)*$num;
foreach ($db->query("SELECT * from article Limit $pagea,$num") as $row)
{
echo "
";
print_r("
删除");
print_r($row[1]);
print_r($row[2]);
print_r($row[3]);
}
$rs = $db->query("select COUNT(*) from article"); //取得数据总数
$count = $rs->fetchColumn();
$pagenum = ceil($count/$num);
?>
添加文章
文章总数:
文章总页:
For($i=1;$i
$show=($i!=$page)?"
$i":"
$i";
Echo $show." ";
}
$db=null;
?>