文章推荐系统(三)_PHP教程
程序员文章站
2022-04-20 20:28:31
...
=====Article.php====
if(!isset($pagenum)){
$pagenum=1;}
$conn=mysql_connect("localhost","user","password");
mysql_select_db("bamboo");
$sql="select count(*) from article";
$result=mysql_query($sql,$conn);
$count=mysql_result($result,0);
$sign=0;
$lesssign=0;
$pagec=1;
for($icount=0;($icount for($i=0;$i if(($icount*16+$i)==$count)
$sign=1;
}
$pagec++;
}
$dispeof=16*$pagenum;
$dispend=16*($pagenum-1);
if($count>=(16*$pagenum))
$dispbeg=16*$pagenum;
else
$dispbeg=$count;
$isdispnum=$count-$dispeof;
if($isdispnum $lesssign=1;
}
echo"";
";
?>
echo"";
";
mysql_close($conn);
?>
(待续)
if(!isset($pagenum)){
$pagenum=1;}
$conn=mysql_connect("localhost","user","password");
mysql_select_db("bamboo");
$sql="select count(*) from article";
$result=mysql_query($sql,$conn);
$count=mysql_result($result,0);
$sign=0;
$lesssign=0;
$pagec=1;
for($icount=0;($icount for($i=0;$i if(($icount*16+$i)==$count)
$sign=1;
}
$pagec++;
}
$dispeof=16*$pagenum;
$dispend=16*($pagenum-1);
if($count>=(16*$pagenum))
$dispbeg=16*$pagenum;
else
$dispbeg=$count;
$isdispnum=$count-$dispeof;
if($isdispnum $lesssign=1;
}
echo"
"; echo $fuhao; echo""; $obj=mysql_fetch_object($result); echo $obj->articlename; echo" |
"; echo $fuhao." n"; echo" |
?>
echo"
$str"; echo" | "; "; $str="当前页是第"; $str=$str.strval($pagenum); $str=$str."页"; echo $str; echo" | "; "; echo"转到第"; for($i=1;$i $strpage=" "; $strpage=$strpage.strval($i); $strpage=$strpage." "; echo"$strpage"; } echo"页"; echo" | ";
mysql_close($conn);
?>
(待续)