Source code for ranking in php + mysql

Source: Internet
Author: User
// Complete source code for the ranking. // you can set topXX on your own! The input value is the top number, the Top number, the top news, the Top news, the top news, and the Top news.

// Complete source code for ranking
// You can set top XX on your own! The input value is the top value.




$ 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 ;}

?>


Top news access rankings




Top news rankings

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 <= $ rows) {echo "";}
}
?> Top news popularity rankings
>


[Close the window]




// News popularity ranking from my news publishing system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.