dongmei6426 2016-03-08 02:40
浏览 17
已采纳

如何在PHP中使用数据库排名选择最佳商店[关闭]

I want to know how to retrieve the details of the best shop to a table in html page. The fields of my SQL database are shop_id, shop_name, shop_Tp, shop_addr, shop_sales, shop_rank

Please help me with this.

Please help me to show this result in a table (Tabular format - ID, Name, Telephone, Address, Sales, Ranking)

My Code

<?php
$con=mysqli_connect("localhost", "root", "osanda92", "test_db");
$mysql="SELECT * FROM shop ORDER BY shop_rank LIMIT 1";
$result=mysqli_query($con,$mysql);
while($row = mysqli_fetch_array($result))
{
    echo $row['shop_id']."</br>".$row['shop_name']."</br>".$row['shop_Tp']."</br>".$row['shop_addr']."</br>".$row['shop_sales']."</br>".$row['shop_rank']."</br></br></br>";
}
mysqli_close($con);
?>
  • 写回答

1条回答 默认 最新

  • douweng7083 2016-03-08 03:15
    关注

    Your question is not 100% clear. But I think you are asking a query to find the best shop. You can write this query to find the best shop.

    SELECT * FROM YourTableName ORDER BY shop_rank LIMIT 1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办