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>"; } 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. 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. Link to comment https://forums.phpfreaks.com/topic/89205-solved-ordering-results-question/#findComment-456762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.