I just did what I thought I could not. I wrote my own code
<?php
function get_stream(){
$sql = "SELECT
`tutorials`.`post_id` AS `id`,
`tutorials`.`post_title` AS `title`,
`tutorials`.`post_cat` AS `cat`,
LEFT(`tutorials`.`post_body`, 512) AS `preview`,
`tutorials`.`post_user` AS `user`,
DATE_FORMAT(`tutorials`.`post_date`, '%m/%d/%Y %h:%i:%s %p') AS `date`,
`tutorial_comments`.`total_comments`,
DATE_FORMAT(`tutorial_comments`.`last_comment`, '%m/%d/%Y %h:%i:%s %p') AS `last_comment`
FROM `tutorials`
LEFT JOIN (
SELECT
`post_id`,
COUNT(`comment_id`) AS `total_comments`,
MAX(`comment_date`) AS `last_comment`
FROM `tutorial_comments`
GROUP BY `post_id`
) AS `tutorial_comments`
ON `tutorials`.`post_id` = `tutorial_comments`.`post_id`
ORDER BY `tutorials`.`post_date` DESC";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_array($result)) {
$myarray[] = $row;
}
}
$sql = "SELECT
`announcements`.`post_id` AS `id`,
`announcements`.`post_title` AS `title`,
LEFT(`announcements`.`post_body`, 512) AS `preview`,
`announcements`.`post_user` AS `user`,
DATE_FORMAT(`announcements`.`post_date`, '%m/%d/%Y %h:%i:%s %p') AS `date`,
`announcement_comments`.`total_comments`,
`announcements`.`post_cat` AS `cat`,
DATE_FORMAT(`announcement_comments`.`last_comment`, '%m/%d/%Y %h:%i:%s %p') AS `last_comment`
FROM `announcements`
LEFT JOIN (
SELECT
`post_id`,
COUNT(`comment_id`) AS `total_comments`,
MAX(`comment_date`) AS `last_comment`
FROM `announcement_comments`
GROUP BY `post_id`
) AS `announcement_comments`
ON `announcements`.`post_id` = `announcement_comments`.`post_id`
ORDER BY `announcements`.`post_date` DESC";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_array($result)) {
$myarray[] = $row;
}
}
$sql = "SELECT
`stream_extras`.`post_id` AS `id`,
`stream_extras`.`post_title` AS `title`,
`stream_extras`.`post_cat` AS `cat`,
LEFT(`stream_extras`.`post_body`, 512) AS `preview`,
`stream_extras`.`post_user` AS `user`,
DATE_FORMAT(`stream_extras`.`post_date`, '%m/%d/%Y %h:%i:%s %p') AS `date`,
`stream_extras_comments`.`total_comments`,
DATE_FORMAT(`stream_extras_comments`.`last_comment`, '%m/%d/%Y %h:%i:%s %p') AS `last_comment`
FROM `stream_extras`
LEFT JOIN (
SELECT
`post_id`,
COUNT(`comment_id`) AS `total_comments`,
MAX(`comment_date`) AS `last_comment`
FROM `stream_extras_comments`
GROUP BY `post_id`
) AS `stream_extras_comments`
ON `stream_extras`.`post_id` = `stream_extras_comments`.`post_id`
ORDER BY `stream_extras`.`post_date` DESC";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_array($result)) {
$myarray[] = $row;
}
}
$sql = "SELECT
`projects`.`post_id` AS `id`,
`projects`.`post_title` AS `title`,
`projects`.`post_cat` AS `cat`,
LEFT(`projects`.`post_body`, 512) AS `preview`,
`projects`.`post_user` AS `user`,
DATE_FORMAT(`projects`.`post_date`, '%m/%d/%Y %h:%i:%s %p') AS `date`,
`project_comments`.`total_comments`,
DATE_FORMAT(`project_comments`.`last_comment`, '%m/%d/%Y %h:%i:%s %p') AS `last_comment`
FROM `projects`
LEFT JOIN (
SELECT
`post_id`,
COUNT(`comment_id`) AS `total_comments`,
MAX(`comment_date`) AS `last_comment`
FROM `project_comments`
GROUP BY `post_id`
) AS `project_comments`
ON `projects`.`post_id` = `project_comments`.`post_id`
ORDER BY `projects`.`post_date` DESC";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_array($result)) {
$myarray[] = $row;
}
}
function cmp($a, $b)
{
if ($a['date'] == $b['date']) {
return 0;
}
return ($a['date'] > $b['date']) ? -1 : 1;
}
usort($myarray , "cmp");
return $myarray;
}
?>