Hi! I have a php script that fetches information from a MYSQL database. At the moment the results are sorted by the newest first. I want the user to be able to select how they want to sort the results using a drop down menu. I want the user to be able to sort using these columns name, url, tag and by id. At the moment this is the code to sort it: $result = mysql_query("SELECT * FROM sites where approved = '1' order by id desc limit $alt,$max"); $resulttot = mysql_query("SELECT * FROM sites where approved = '1' order by id desc"); $count = mysql_num_rows($resulttot); while($row = mysql_fetch_array($result)) Thanks so much!!!!! Adam
you will have to set a function to do this like function sort($arg) { $result = mysql_query("SELECT * FROM sites where approved = '1' order by '$arg'); } PHP: