affordit Posted February 3, 2008 Share Posted February 3, 2008 Is there a way to order the results from this query? $query_content= "SELECT `heading`, `picture`, `description` FROM `content`"; $result=mysql_query($query_content) or die(mysql_error()); while ($info = mysql_fetch_array($result)) { echo $info['heading']; echo "<BR>"; echo $info['image']; echo "<BR>"; echo $info['description']; echo"<BR>"; } Quote Link to comment https://forums.phpfreaks.com/topic/89205-solved-ordering-results-question/ Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 You can use sql's ORDER BY directive to order alphabetically. Say by the heading field.... $query_content= "SELECT heading, picture, description FROM content ORDER BY heading"; ps: No need for all the `backticks` either. Quote Link to comment https://forums.phpfreaks.com/topic/89205-solved-ordering-results-question/#findComment-456756 Share on other sites More sharing options...
affordit Posted February 3, 2008 Author Share Posted February 3, 2008 Thanks thorpe and thanks for the heads up on the back ticks deal. Quote Link to comment https://forums.phpfreaks.com/topic/89205-solved-ordering-results-question/#findComment-456762 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.