这是mysql表
---------------------------------------------
id | date | name | amount
---------------------------------------------
1 | 2013-01-31 | abcd | 200.000
2 | 2013-02-28 | apple | 95.000
3 | 2013-03-31 | bannna | 30.000
4 | 2013-04-30 | computer | 5.000
5 | 2013-05-31 | mobile | 500.000
6 | 2013-06-30 | mouse | 2.000
7 | 2013-07-31 | led tv | 25000.000
---------------------------------------------
如何找到该表的最高值金额
我想要这样的结果在 php 页面最高金额值 1st
Date | Name | Amount
2013-07-31 | LED TV | 25000.000
2013-05-31 | Mobile | 500.000
2013-01-31 | Abcd | 200.000
2013-02-28 | Apple | 95.000
我该怎么做请帮我解决这个问题谢谢
我正在使用此代码,但它没有显示我的结果类型。
<?php
$username = "root";
$password = "";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("car",$dbhandle)
or die("Could not select examples");
//execute the SQL query and return records
$result = mysql_query("SELECT MAX( amount ) AS amount FROM table5");
//fetch tha data from the database
while ($row = mysql_fetch_array($result)) {
echo "Date:".$row{'date'}." Name:".$row{'name'}."Amount: ". //display the results
$row{'amount'}."<br>";
}
//close the connection
mysql_close($dbhandle);
?>