m8t Posted June 20, 2009 Report Posted June 20, 2009 Tātad, Es vēlos savai lapai izveidot top 10 postotājus. Man ir tabula ar lietoāja datiem un postiem. Pašlaik esmu nonācis līdz šim: include("connection.php"); $query = "SELECT * FROM {$tblprefix}users GROUP BY posts ORDER BY posts ASC LIMIT 10"; $run = mysql_query($query) or die("Error running query: " . mysql_error()); while($row = mysql_fetch_array($run)) { echo "<li>[b]...[/b] vieta - <a href=\"user.php?id={$row['id']}\" title=\"{$row['username']}\">{$row['username']}</a></li>"; } Kāl ia es izveidoju, lai man lietotāji sadalītos par 1,2, 3... vietu, līdz pat 10? Saprotu kā izvilkt 10 lielākos postotājus, bet nesaprotu, kā viņiem pilikt klāt vietas nr. Ceru ka palīdzēsit -Shizo0 Quote
Kavacky Posted June 20, 2009 Report Posted June 20, 2009 $i = 0; while ($row = mysql_fetch_array($run)) { $i++; // Šī lietotāja vieta echo $row['name'], ', tu esi ', $i, '. vietā!'; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.