Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-11-08, 08:59 AM
Junior Member
 
Join Date: Sep 2006
Posts: 5
FattyNoob is on a distinguished road
Default create a ranking system.

what would the proper syntax be with php and mysql to generate a "rank" system based on a variable.?

$topplayers="SELECT * from users order by skillpts DESC Limit $start, 20";

what would i have to add or type from this to view the rankings?

thanks any help
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2006-11-11, 04:25 AM
Junior Member
 
Join Date: Sep 2006
Posts: 5
FattyNoob is on a distinguished road
Default

no1 knows?? how do i post the order number 1,2,3
Reply With Quote
  #3 (permalink)  
Old 2006-11-11, 09:29 AM
Senior Member
 
Join Date: Jul 2006
Location: Prague, Czech Republic
Posts: 193
vladimir_cz is on a distinguished road
Send a message via ICQ to vladimir_cz Send a message via MSN to vladimir_cz Send a message via Yahoo to vladimir_cz Send a message via Skype™ to vladimir_cz
Default

use next functions:

mysql_connect
mysql_select_db
mysql_query
mysql_fetch_assoc
echo
__________________
Thank you. Vladimir, Czech Republic.
http://www.smartwebco.com/
I'm looking for job.
Reply With Quote
  #4 (permalink)  
Old 2006-11-13, 03:43 PM
Junior Member
 
Join Date: Sep 2006
Posts: 5
FattyNoob is on a distinguished road
Default

if(!isset($start))
{
$start=0;
}
$order="SELECT * from users";
$order2=mysql_query($order);
$d=0;
$f=0;
$g=1;
print "<center>Page: ";
while($order3=mysql_fetch_array($order2))
{
if($f%20==0)
{
print "<A href='field.php?start=$d'>$g</a> ";
$g++;
}
$d=$d+1;
$f++;
}
print "<table class='table'>";
print "<table width=86% align=center bgcolor=#000000 border=1 cellspacing=5>";
print "<td valign='center'>";
print "<tr class='headline'><center>ATTACK!!!</center></tr>";
print "<tr><td>ID#</td><td>Player</td><td>Skill</td><td><font color='#ffd700'>Cash</font></td><td>Army Size</td><td>Honor</td><td>Land</td></tr>";
$topplayers="SELECT * from users order by skillpts DESC Limit $start, 20";
$topplayers2=mysql_query($topplayers) or die("Could not query players");
while($topplayer3=mysql_fetch_array($topplayers2))

{
$topplayer3[playername]=strip_tags($topplayer3[playername]);
$topplayer3[gold]=number_format($topplayer3[gold]);
$topplayer3[skillpts]=number_format($topplayer3[skillpts]);

$topplayer3army=number_format($topplayer3[dffarmy]+$topplayer3[offarmy]);
$topplayer3[honor]=number_format($topplayer3[honor]);
$topplayer3[land]=number_format($topplayer3[land]);
print "<tr><td>$topplayer3[ID]</td><td><A href='target.php?ID=$topplayer3[ID]'>$topplayer3[playername]</a></td><td>$topplayer3[skillpts]</td><td><font color='#ffd700'>$topplayer3[gold]</font></td><td>$topplayer3army</td><td>$topplayer3[honor]</td><td>$topplayer3[land]</td></tr>";
}
print "</table>";


i have this, it works great, but id like to change the column ID into rank and post 1,2,3,4,5 etc.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:40 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.