<?php
$dbhost = 'localhost';
$dbuser = 'database user';
$dbpass = 'password';
$dbname = 'database name';
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die ('Error connecting to mysql');
mysql_select_db($dbname);
$tableName="ratings";
$result = mysql_query("SELECT id ,total_votes
FROM ratings
ORDER BY total_votes DESC
LIMIT 0, 100")
or die(mysql_error());
echo "<table>";
// keeps getting the next row until there are no more
while($row = mysql_fetch_array( $result ))
{
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['id'];
echo "</td><td>";
echo $row['total_votes'];
echo "</td></tr>";
}
echo "</table>";
?>
حيث انى اضفت الاستعلام فى الامر select للحصول على اى دى المدخل كما ذكرت واستعلام على نسبة التصويت علية