leeandrew Posted March 30, 2008 Share Posted March 30, 2008 I have this code: <?php $sql="SELECT * FROM `voting_items` WHERE `contact` > 1 ORDER BY `contact` DESC LIMIT 100"; $result=mysql_query($sql); for($i = 0; $i < 100; $i++) { $row = mysql_fetch_array($result); $name = $row["name"]; $prestige = $row["contact"]; $rank = $i + 1; echo "<td width='2%'>$rank.</td>"; echo "<td width='28%' style='text-align:left'>$name</td>"; echo "<td width='70%'>$prestige</td></tr>"; } ?> This code lists the top 100 users on my site by prestige number (1-100). How can i count multiple columns, add them together and redo the list to display the top 100 based on the overall result? For instance, count 10 columns and find the overall number, then list by that Link to comment https://forums.phpfreaks.com/topic/98704-sql-count/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.