PDA

View Full Version : how display posts only one forum ?


roxxx
07-16-2007, 07:50 AM
how display posts only one forum ?

How will be query ?

nexialys
07-16-2007, 11:25 AM
hum, you'll have to be clearer on this one, and use a basic english language... translation engines are horrible with small sentences.

roxxx
07-16-2007, 12:51 PM
example: Programming Discussions
how display use query last 10 posts (post not thread) with Programming Discussions ?

nico_swd
07-16-2007, 05:23 PM
"SELECT * FROM ". TABLE_PREFIX ."post WHERE forumid = xx AND visible = 1"


??

roxxx
07-16-2007, 06:38 PM
yes, I tried same, but

forumid field is not into tables post :(

nico_swd
07-16-2007, 06:52 PM
I see. And...


"SELECT
post.*
FROM
". TABLE_PREFIX ."thread AS thread,
". TABLE_PREFIX ."post AS post
WHERE
thread.forumid = XX AND
post.threadid = thread.threadid AND
post.visible = 1
GROUP BY
post.postid
LIMIT
10"


?

roxxx
07-17-2007, 10:38 AM
thank you

Eikinskjaldi
07-17-2007, 11:34 PM
that query wont show the latest 10.

You will need to add an order by post.dateline (or postid, I guess) desc at the end. Also, you should use join to join tables, not where

"SELECT post.*
FROM ". TABLE_PREFIX ."thread AS thread,
JOIN ". TABLE_PREFIX ."post AS post
USING (threadid)
WHERE
thread.forumid = XX AND
post.visible = 1
ORDER BY
post.postid DESC
LIMIT
10"