Jump to content

Archived

This topic is now archived and is closed to further replies.

HaZaRd420

Sort Help!

Recommended Posts

I want to know how can I sort my members in a certain table from a-z, I have it sorted as z-a, i want to switch it up but have no clue on doing so.

Heres my displaying page:
[code]<?php
//PHP Adminpanel v1.0 //
include('config.php');

$connection = mysql_connect( "$host","$user","$pass" ) or die(mysql_error());

$rs = mysql_select_db( "$db" );

$sql=" select * from roster order by alias $sort ";

$rs = mysql_query($sql) or die(mysql_error());

echo '<table width="100%">
<tr>
<td bgcolor="1E1A13"><font face="verdana" size=2 color="FFFFFF"><b><center>Alias</b></td>
<td bgcolor="1E1A13"><font face="verdana" size=2 color="FFFFFF"><b><center>ClanRank:</b></td>
<td bgcolor="1E1A13"><font face="verdana" size=2 color="FFFFFF"><b><center>Division:</b></td>
<td bgcolor="1E1A13"><font face="verdana" size=2 color="FFFFFF"><b><center>Status:</b></td>
</tr>';
while ( $row = mysql_fetch_array( $rs) )
{
echo '
<tr>
<td bgcolor="99958E"><font face="verdana" size=1 color="FFFFFF">'.$row["alias"].'</td>
<td bgcolor="99958E"><font face="verdana" size=1 color="FFFFFF">'.$row["clanrank"].'</td>
<td bgcolor="99958E"><font face="verdana" size=1 color="FFFFFF">'.$row["division"].'</td>
<td bgcolor="99958E"><font face="verdana" size=1 color="FFFFFF">'.$row["status"].'</td>
</tr>
';
}
?>
[/code]

and the config:

[code]
<?php
//PHP Work//

// Set mysql server info here//

$host ="localhost"; //This is the mysql host//
$user ="user"; //This is the Mysql Username//
$pass ="password"; //This is the Mysql Password//
$db ="db"; //This is the Name of the Database you have the information stored in//
$sort ="desc"; //to sort the oldest to news shows enter asc to sort from newest to oldest enter desc //

?>
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=352421:date=Mar 7 2006, 02:52 AM:name=HaZaRd420)--][div class=\'quotetop\']QUOTE(HaZaRd420 @ Mar 7 2006, 02:52 AM) [snapback]352421[/snapback][/div][div class=\'quotemain\'][!--quotec--]
$sql=" select * from roster order by alias $sort ";

$sort ="desc"; //to sort the oldest to news shows enter asc to sort from newest to oldest enter desc //

[/quote]

You may want to try switching desc to asc. Descending typically means from Z-A, and Ascending typically means from A-Z. I'd give that a shot, though I could be way off here.

Share this post


Link to post
Share on other sites
Hey Blurring, that worked out, Thanks alot. It was right in front of my eyes!!! Thanks alot man!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.