$query?=?"select?*?from?userlist?where?username?=?'$lune'?ORDER?BY?id?DESC?LIMIT?1";?
創新互聯作為成都網站建設公司,專注重慶網站建設、網站設計,有關成都企業網站定制方案、改版、費用等問題,行業涉及成都餐廳設計等多個領域,已為上千家企業服務,得到了客戶的尊重與認可。
$result?=?mysqli_query($link,?$query);?
$row?=?mysqli_fetch_array($result);?
echo?$row['gangwei'];
最簡單的方式,既然有ID,直接通過ID排序,取一條即可.
您使用了limit 0,1就只有一條了,就是你要的最后一條。也許你問的問題沒有說清楚
select a.name name1,a.*,b.value,b.* from piwik_site a,piwik_archive_numeric_2013_10 b where b.period in(1,2,3) and b.name='nb_visits' and a.idsite=b.idsite order by b.value desc
如果頁面顯示的是這個語句,那么最后一個應該是select a.name name1,a.*,b.value,b.* from piwik_site
a,piwik_archive_numeric_2013_10 b where b.period in(1,2,3) and
b.name='nb_visits' and a.idsite=b.idsite order by b.value asc limit 1
或者先執行一次select count(*) 拿到數量num,再select a.name name1,a.*,b.value,b.* from piwik_site
a,piwik_archive_numeric_2013_10 b where b.period in(1,2,3) and
b.name='nb_visits' and a.idsite=b.idsite order by b.value desc limit num-1,1
$con = mysql_connect("localhost","root","");//連接數據庫
mysql_select_db("btxiazai",$con);//選擇數據庫
mysql_query("set names utf8");
$sql = "select * from persons order by id desc limit 2";//獲取persons中的數據,并按id倒敘排列,取其中兩條
$get = mysql_query($sql);//執行sql
while($result = mysql_fetch_assoc($get)){//取回數據
}
名稱欄目:php獲取最后一組數據 php 取數組第一個
鏈接URL:http://m.kartarina.com/article26/hgscjg.html
成都網站建設公司_創新互聯,為您提供自適應網站、App開發、網站維護、外貿建站、虛擬主機、面包屑導航
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯