
<?php
//详情联系QQ:1195989301
自己引用数据库类文件
$c = $db->get_one("select count(*) from `{$DT_PRE}brand_vote` where fid=$fid");
$totalnums = $c['count(*)']; /*总记录数*/
$fnum = 20; /*每页显示条数*/
$pagenum = ceil($totalnums / $fnum); /*翻页数*/
@$tmp = $_GET['page']; /*页数常量*/
if ($tmp > $pagenum) echo "<script>window.location.href='index.php'</script>"; /*防止恶意翻页*/
/*计算分页起始页 */
if ($tmp == "") {
$num = 0;
} else {
$num = ($tmp - 1) * $fnum;
}
// 查询语句
$sql = "SELECT * FROM 表名 where 条件 LIMIT " . $num . ",$fnum";
$result = $db->query($sql);
while($r = $db->fetch_array($result)) {
$A[] = $r;
}
?>