If you only want the TOP 5 then you only need one limiter like this
Also if you use double quotes around your query you can expand $variables
automatically, which makes it a lot easier to read and debug.
Also if you want to see the errors produced by the mysql_
extension you have to look for them
$top_5_please = 5;
$req2 = mysql_query("select id, url, name, description, banner, votes
from topsite
order by votes desc
limit $top_5_please");
// error check
if ( ! $req2 ) {
echo mysql_error();
exit;
}
while($dnn2 = mysql_fetch_array($req2))
FINAL NOTE
Please dont use the mysql_
database extensions, it is deprecated (gone for ever in PHP7)
Especially if you are just learning PHP, spend your energies learning the PDO
or mysqli_
database extensions,
and here is some help to decide which to use