paulman888888 Posted June 4, 2008 Share Posted June 4, 2008 This is the code for my view scores <?php // Get sort method $sort = isset($_GET['order']) ? mysql_real_escape_string($_GET['order']) : 'score'; // Get all the data from the "myscore2" table $result = mysql_query("SELECT * FROM myscore2 ORDER BY `{$sort}` DESC"); //the rest is not important How could i add a AESC or DESC link Link to comment https://forums.phpfreaks.com/topic/108718-solved-quick-question/ Share on other sites More sharing options...
revraz Posted June 4, 2008 Share Posted June 4, 2008 I think you've used your allotment for the different posts with the same title today. And why don't you just reply with that question in the thread that gave you that code? Link to comment https://forums.phpfreaks.com/topic/108718-solved-quick-question/#findComment-557515 Share on other sites More sharing options...
craygo Posted June 4, 2008 Share Posted June 4, 2008 Could just add another form field asking the user. and use the same type of code you used for the sort Ray Link to comment https://forums.phpfreaks.com/topic/108718-solved-quick-question/#findComment-557517 Share on other sites More sharing options...
The Little Guy Posted June 4, 2008 Share Posted June 4, 2008 use a get, and send it ASC or DESC $sort = $_GET['sort']; $query = 'SELECT * FROM myscore2 '; switch($sort){ case 'ASC': $query .= 'ORDER BY score ASC'; break; case 'DESC': $query .= 'ORDER BY score DESC'; break; } $sql = mysql_query($query); Link to comment https://forums.phpfreaks.com/topic/108718-solved-quick-question/#findComment-557518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.