aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 886
1148 credits Members referred : 4
« on: Sep 11, 2006, 12:20:20 am »
when the data is pulled from the database and it is printed on the screen (up to 20 items at once) how do you make it number each item? i know you can echo the item ID, but if you delete one, that will mess up the numbering for future items.. if you understand this, help please
when the data is pulled from the database and it is printed on the screen (up to 20 items at once) how do you make it number each item? i know you can echo the item ID, but if you delete one, that will mess up the numbering for future items.. if you understand this, help please
olaf: that script is mighty large considering the simplicity of what im trying to do
designer: how would i go about doing that?
because pagination could be tricky I wrote this very easy to use php script, check the example and compare this with this real live page: http://www.all4yourwebsite.com/search.php
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 886
1148 credits Members referred : 4
« Reply #6 on: Sep 11, 2006, 08:21:18 pm »
for some reason my results started at #32 instead of #1, so this is what my code looks like:
Code:
<?php if ($_GET["order"]=="cmb") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_cmb DESC LIMIT 20"); } elseif ($_GET["order"]=="hp") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_hp DESC LIMIT 20"); } elseif ($_GET["order"]=="overall") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_overall DESC LIMIT 20"); } elseif ($_GET["order"]=="player") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_name ASC LIMIT 20"); } elseif ($_GET["order"]=="cmb-sort=asc") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_cmb ASC LIMIT 20"); } elseif ($_GET["order"]=="hp-sort=asc") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_hp ASC LIMIT 20"); } elseif ($_GET["order"]=="overall-sort=asc") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_overall ASC LIMIT 20"); } elseif ($_GET["order"]=="player-sort=desc") { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_name DESC LIMIT 20"); } else { $result = dbquery("SELECT * from ".$db_prefix."hiscores ORDER BY player_cmb DESC LIMIT 20"); } while ($data = dbarray($result)) {$i ++; $player_id = $data['player_id']; $player_user = $data['player_user']; include(ADMIN."hiscores/highest_skill_formula.php"); include(ADMIN."hiscores/colors.php"); include(ADMIN."hiscores/account_converter.php"); $update; echo "<tr>"; echo "<td class='tbl1' align='center'><small><font color='$player_color'>"; echo $i - 31; echo "</font></small></td>"; echo "<td class='tbl2' align='left'><small><font color='$player_color'>".$data['player_name']."</font></small></td>"; echo "<td class='tbl1' align='center'><small><font color='$player_color'>".$data['player_cmb']."</font></small></td>"; echo "<td class='tbl2' align='center'><small><font color='$player_color'>".$data['player_hp']."</font></small></td>"; echo "<td class='tbl1' align='center'><small><font color='$player_color'>".$data['player_overall']."</font></small></td>"; echo "<td class='tbl2' align='center'><small><font color='$player_color'>".$highest_skill." ".$skill_name."</font></small></td>"; echo "</tr>"; } ?>
currently, with $i - 31, it is working, showing 1, 2, 3, etc.