Jump to content

Sorting two mySQLs into one array by the date


LanceT

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.