PDA

View Full Version : grab the latest attachment from certain forum id


corsacrazy
09-11-2003, 07:28 AM
:rolleyes: im looking for a small query to grab the latest attachment only jpg's in a certain forum id to be displayed on the home page :D possible ?

corsacrazy
09-12-2003, 01:31 PM
the image should also link to the thread where it came from

corsacrazy
10-12-2003, 06:52 AM
ok here is sumthin similar but i need to modify it

$attach=$DB_site->query_first("SELECT attachmentid,counter,filename FROM attachment ORDER BY counter DESC LIMIT 1");

i need to add a forum id there sumhow select from* forum id XXX

assassingod
10-12-2003, 07:01 AM
I can't remember much of vB2 code, but try:


$attach=$DB_site->query_first("
SELECT attachmentid,counter,filename,dateline
FROM attachment
WHERE forumid = 'x'
ORDER BY dateline DESC
LIMIT 1");

corsacrazy
10-12-2003, 07:10 AM
i get this error Invalid SQL:
SELECT attachmentid,counter,filename,dateline
FROM attachment
WHERE forumid = '24'
ORDER BY dateline DESC
LIMIT 1
mysql error: Unknown column 'forumid' in 'where clause'

mysql error number: 1054









I can't remember much of vB2 code, but try:


$attach=$DB_site->query_first("
SELECT attachmentid,counter,filename,dateline
FROM attachment
WHERE forumid = 'x'
ORDER BY dateline DESC
LIMIT 1");

assassingod
10-12-2003, 07:18 AM
Yeah - didn't think it'll work. I'll look into it

corsacrazy
10-14-2003, 01:41 PM
im still trying and no luck :( any news assassin ?