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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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); Quote Link to comment 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.