Home >Backend Development >PHP Tutorial >Source code for making rankings in php+mysql_PHP tutorial

Source code for making rankings in php+mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:23:251135browse

//Complete source code for ranking list
//You can decide the top XX by yourself! The number entered is the number of top




if ($top){ if ($top){
$query="select count(*) as total from data";
$result=mysql_query($query);
$message_count=mysql_result($result,0,"total");
if ($key>$message_count) {$key=$message_count;}

?>


Hot News Access Ranking




Top News Access Ranking Top

Ranking News Title
Category
Popularity


$query="select id,detail,title,hits,type from data order by hits desc limit 0,$key";
$result =@mysql_query($query);
$rows=@mysql_num_rows($result);
$i=1;

while($myrow=@mysql_fetch_array($result)){
?>
$myrow[title]
$myrow[type]
$myrow[hits]" ?>

$i++;
if ($i}
?>
News Popularity Ranking Top
>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn