我想選擇前5名成績,但每當增加order by votes desc limit 5
這個代碼:選擇前5的結果:PHP/SQL
$req2 = mysql_query('select id, url, name, description, banner, votes
from topsite
order by votes desc
limit '.$first_message .','.$last_message);
while($dnn2 = mysql_fetch_array($req2))
將無法正常工作。我該如何解決它?
請不要使用'mysql_'數據庫擴展,它已被棄用(一去不復返在PHP7) 特別是如果你剛開始學習PHP,花你的精力學習'PDO'或'mysqli_'數據庫擴展, [和這裏是一些幫助來決定使用](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – RiggsFolly
什麼是$ first_message和$ last_message?爲了只獲得前5名,只需按降序排列,並限制爲5。 –
*「它不會工作」*請更具體地說 – m02ph3u5