[英]PHP list top 10 highest vaules in MySQL table
I'm trying to list the top highest 10 values in my MySQL table. 我正在尝试在MySQL表中列出最高的前10个值。
I've tried this: 我已经试过了:
$SQL = ("SELECT * Rating FROM download_manager ORDER BY Rating DESC LIMIT 10;");
$results = mysqli_query($SQL);
var_dump($results);
However that returns a NULL, also I'd need it to echo back two rows and not the whole table... 但是,这将返回NULL,我还需要它回显两行而不是整个表...
DB Structure: id | 数据库结构:id | filename | 文件名| downloads 下载
I need to just echo back the top 10 highest downloads and the associated filename. 我只需要回显前十名的最高下载量和相关的文件名。
Update: 更新:
Rating is not the table, connection is done through a require connect. 等级不是表格,连接是通过require连接完成的。 I've removed the () however still get a null. 我已删除了(),但仍然为null。
Try that 试试看
$SQL = "SELECT Rating FROM download_manager ORDER BY Rating DESC LIMIT 10;";
$results = mysqli_query($SQL);
var_dump($results);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.