recent posts:
//connection info
require("connect.php");
$alldata = array();
$alldates = array();
$blogcount=0; // keep track of number of blogs
$notin = "7, 1, 2";
$blogarray = "SELECT blog_id, blog_site_url, blog_name, blog_description FROM mt_blog WHERE blog_id NOT IN ($notin)";
$resultblog = mysql_query($blogarray) or die (mysql_error());
while ($rowblog = mysql_fetch_array($resultblog)) {
$burl = ($rowblog['blog_site_url']);
$bname = ($rowblog['blog_name']);
$bdesc = ($rowblog['blog_description']);
$bid = ($rowblog['blog_id']);
$rowarray = "SELECT entry_created_on, entry_id, entry_blog_id FROM mt_entry WHERE (entry_blog_id = (".$rowblog['blog_id'].")) ORDER BY entry_created_on DESC";
$resultid = mysql_query($rowarray) or die (mysql_error());
$count=0;
while ($rowid = mysql_fetch_array($resultid)) {
if ($count>0) { break; } //to ensure that if there are less than 1 posts the blog will not break the query
$maxarray = "SELECT entry_title, entry_id, entry_created_on FROM mt_entry WHERE entry_created_on = '".$rowid['entry_created_on']."' and entry_id = ".$rowid['entry_id']; $resultmax = mysql_query($maxarray) or die (mysql_error());
while ($rowmax = mysql_fetch_array($resultmax)) {
$ids = array($rowmax['entry_id']);
$date = ($rowmax['entry_created_on']);
$title = ($rowmax['entry_title']);
//saves the data int alldata array for use outside of the while loop
$alldates[$blogcount++] = $date;
$alldata[$blogcount++] = array('bname'=>$bname, 'burl'=>$burl, 'bdesc'=>$bdesc, 'bid'=>$bid, 'ids'=>$ids, 'title'=>$title);
}
$count++;
}
}
array_multisort($alldates, SORT_DESC, $alldata);
echo "