Sean S
02-09-2007, 05:59 AM
Hi there,
I'm trying to store the first attachment of the first post in a variable, but no matter what I do, I either get errors, or the showthread page stops loading.
basically this is the code that I have, but it doesn't work. I'm not really sure how I would store the first attachment of the firstpost in a variable,
global $vbulletin, $db;
# First Attachment of the First Post
$firstattach = $db->query_read("
SELECT a.attachmentid, a.dateline, a.postid, t.firstpostid
FROM " . TABLE_PREFIX . "attachment a
LEFT JOIN " . TABLE_PREFIX . "thread t ON t.firstpostid = a.postid
ORDER BY a.attachmentid DESC
LIMIT 1
");
while($row = $db->fetch_array($firstattach))
{
$attachdateline= $row['dateline'];
$attachid= $row['attachmentid'];
eval('$tested .= "' . fetch_template('tested') . '";');
}
Any sort of help would be appreciated,
thank you.
I'm trying to store the first attachment of the first post in a variable, but no matter what I do, I either get errors, or the showthread page stops loading.
basically this is the code that I have, but it doesn't work. I'm not really sure how I would store the first attachment of the firstpost in a variable,
global $vbulletin, $db;
# First Attachment of the First Post
$firstattach = $db->query_read("
SELECT a.attachmentid, a.dateline, a.postid, t.firstpostid
FROM " . TABLE_PREFIX . "attachment a
LEFT JOIN " . TABLE_PREFIX . "thread t ON t.firstpostid = a.postid
ORDER BY a.attachmentid DESC
LIMIT 1
");
while($row = $db->fetch_array($firstattach))
{
$attachdateline= $row['dateline'];
$attachid= $row['attachmentid'];
eval('$tested .= "' . fetch_template('tested') . '";');
}
Any sort of help would be appreciated,
thank you.