I'm pulling forum post info (title, post, post_time, etc) and I'm having trouble getting the time/day to display properly:
$sql = "SELECT p.*, pt.*, f.*
FROM phpbb_posts p, phpbb_posts_text pt, phpbb_forums f
WHERE pt.post_text LIKE '%$firstname $lastname%'
AND pt.post_id = p.post_id
AND f.forum_id = p.forum_id
AND f.forum_id = '89'
ORDER BY p.post_time DESC";
if (!$result = mysql_query($sql))
{
die("No recent news :: " . mysql_error());
}
while ($row = mysql_fetch_array($result))
{
$title[] = $row["post_subject"];
$post_text[] = $row["post_text"];
$topic_id[] = $row["topic_id"];
$time[] = $row["post_time"];
}
$count = count($title);
foreach ($time as $newtime)
{
$newdate = date("D M d, Y g:i a", $newtime);
}
echo "<br><table align=\"center\" width=\"500\"><tr bgcolor=\"#000066\"><td style=\"font-family: Arial,Helvetica,sans-serif; font-weight: bold; font-size:12px; color:#ffffff; text-decoration:none; \"> $firstname $lastname in the news</td></tr>";
for($i=0;$i<$count;$i++)
{
preg_match_all('#^\s*[url=?$#im', $post_text, $matches);
preg_match('%(?<=<span class="postbody">)(.*)\n\n<br />%s', $post_text, $matches);
$newurl = preg_replace('%\[url=([^]]+.*.*[^[]+)\[/url\]%', "<br><a href=\"http://www.fantasyplaymakers.com/phpBB2/viewtopic.php?t=$topic_id[$i]\">Discuss...</a>", $post_text);
echo "<tr><td><b><u>".$title[$i]."</u></b></td></tr><tr><td>".$newurl[$i]."</td></tr><tr><td> </td></tr>";
echo "<tr><td>".$newdate."</td></tr>";
}
echo "</table>";
The problem is it only shows the first retrieved date...Not the unique date for each post.