LanceT Posted June 1, 2009 Share Posted June 1, 2009 So I am creating a new RSS feed that takes contents from two different mysql tables. I am using the following code $query = "select dateline, url, title, description,rssdate from `articles` WHERE pagenumber='1' ORDER by id DESC limit 15"; $result = mysql_query($query, $dbh); while ($line = mysql_fetch_assoc($result)) { $return[] = $line; } $query2 = "select dateline, link_url, title, category, rssdate from `rotator` WHERE category='movie' ORDER by id DESC limit 5"; $result2 = mysql_query($query2, $dbh); while ($line2 = mysql_fetch_assoc($result2)) { $return[] = $line2; } I want to have the resulting array ($return) sorted by "dateline" (which is a number that organizes the dates of each item). Now how do I go about sorting this array? Thanks Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted June 1, 2009 Share Posted June 1, 2009 Why don't you just use a UNION in MySQL and have the database sort it? Then you only need to make one database call. 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.