Log in

View Full Version : showing polls from 1 forum only


DionDev
05-22-2008, 08:38 PM
im having some trouble with this

ive got polls to show on a non-vb page, and the results if the person has voted

now i just want polls from 1 specific forum (forum 4) to display on the page

this is my select statement code:


$sql = 'SELECT poll.*, thread.* FROM poll AS poll, thread AS thread
WHERE thread.forumid = 4
ORDER BY dateline DESC
LIMIT 1';
which is giving me an error

im not very good a doing mysql joins/left joins right now....little help?

MoT3rror
05-22-2008, 09:30 PM
SELECT poll.*, thread.*
FROM thread AS thread
LEFT JOIN poll AS poll ON (poll.pollid = thread.pollid)
WHERE thread.forumid = 4
ORDER BY thread.dateline DESC
LIMIT 1

DionDev
05-22-2008, 09:48 PM
SELECT poll.*, thread.*
FROM thread AS thread
LEFT JOIN poll AS poll ON (poll.pollid = thread.pollid)
WHERE thread.forumid = 4
ORDER BY thread.dateline DESC
LIMIT 1

perfect thanks!