HaZaRd420 Posted March 7, 2006 Share Posted March 7, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/4305-sort-help/ Share on other sites More sharing options...
Fred708 Posted March 7, 2006 Share Posted March 7, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/4305-sort-help/#findComment-14974 Share on other sites More sharing options...
HaZaRd420 Posted March 7, 2006 Author Share Posted March 7, 2006 Hey Blurring, that worked out, Thanks alot. It was right in front of my eyes!!! Thanks alot man! Quote Link to comment https://forums.phpfreaks.com/topic/4305-sort-help/#findComment-14975 Share on other sites More sharing options...
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.