DrTrans Posted August 18, 2009 Share Posted August 18, 2009 I need some help with figuring out sorting $connect = ('localhost','root',''); mysql_select_db("tester"); $query = "SELECT * FROM tester"; $result = mysql_connect($query); while($row=mysql_fetch_array($result)) { $id = $row['id']; $prop = $row['propertyname']; echo "$prop -- $id "; } Now i want it to sort it A to Z by first letter of $prop. Thanks DrTrans Link to comment https://forums.phpfreaks.com/topic/170772-solved-help-with-sorting-records/ Share on other sites More sharing options...
bubbasheeko Posted August 18, 2009 Share Posted August 18, 2009 Hi DrTrans, Change your query to this: $query = "SELECT * FROM tester SORT BY tester DESC"; or it is ASC rather than DESC...kinda tired to think lol Link to comment https://forums.phpfreaks.com/topic/170772-solved-help-with-sorting-records/#findComment-900631 Share on other sites More sharing options...
DrTrans Posted August 18, 2009 Author Share Posted August 18, 2009 I goofed myself Would this be sufficent: $query = "SELECT * FROM tester where Active = '$active ' SORT BY tester ASC"; Link to comment https://forums.phpfreaks.com/topic/170772-solved-help-with-sorting-records/#findComment-900634 Share on other sites More sharing options...
DrTrans Posted August 18, 2009 Author Share Posted August 18, 2009 Just in case others are wondering i fixed this problem by doing this $query = "SELECT * FROM tester WHERE active = "$active" ORDER BY tester ASC"; Thanks Dr Trans Link to comment https://forums.phpfreaks.com/topic/170772-solved-help-with-sorting-records/#findComment-900643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.