getting forums messages

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nosti
Forum Newbie
Posts: 4
Joined: Thu Dec 02, 2004 7:20 am

getting forums messages

Post by nosti »

lets say i have these tables:

forums [id, opendate, title]
^
forums info table

forumsmessages [id, writedate, userid, content, replytoid]
^
message info: who wrote it, when, what and in reply to which messsage (if NULL, its a new message)

How do i get them all in on SELECT from the DB in the right order, the order in which i can just print them

i thank you very much if you can help me
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Look up JOINS in an SQL manual.
You also need to look at ORDER BY.

Quick hint...

SELECT x,y FROM table1,table2 WHERE table1.join_col=table2.join_col ORDER BY x,y DESC;

NOTE: Whilst I don't mind helping (and I think I speak for the majority of people on this forum), it would be better if you could spend a bit of time doing some research/reading first. After all why should we spend time helping you when you don't spend time helping yourself ?
Post Reply