ManagerJosh
04-09-2005, 09:52 PM
Could someone optimized the following code for me? It's taking too long to render a bit of XML for external.php
if ($_REQUEST['type'] == 'STREAM')
{ // check for attachments
$attachments = $DB_site->query("
SELECT attachment.filename, attachment.filesize, attachment.attachmentid, attachment.postid
FROM " . TABLE_PREFIX . "attachment
LEFT JOIN " . TABLE_PREFIX . "post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "thread ON (post.postid = thread.firstpostid)
ORDER BY thread.dateline DESC
LIMIT 15
");
while ($attachment = $DB_site->fetch_array($attachments))
{
$post['attachments']["$attachment[attachmentid]"] = $attachment;
}
}
Also, I tried adding a WHERE parameter to filter for threads only with attachments, but no luck.
Can anyone figure out what's up? :)
if ($_REQUEST['type'] == 'STREAM')
{ // check for attachments
$attachments = $DB_site->query("
SELECT attachment.filename, attachment.filesize, attachment.attachmentid, attachment.postid
FROM " . TABLE_PREFIX . "attachment
LEFT JOIN " . TABLE_PREFIX . "post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "thread ON (post.postid = thread.firstpostid)
ORDER BY thread.dateline DESC
LIMIT 15
");
while ($attachment = $DB_site->fetch_array($attachments))
{
$post['attachments']["$attachment[attachmentid]"] = $attachment;
}
}
Also, I tried adding a WHERE parameter to filter for threads only with attachments, but no luck.
Can anyone figure out what's up? :)