hi,
i am trying to build a message board in php with mysql as back end;
what i want to do is to query the database in a certain way that the result 
is returned in the correct order for php to display the discussion thread 
properly
here is my table structure:
mysql> show fields from posts
-> ;
+-------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+----------------+
| msgid | bigint(20) unsigned | | PRI | NULL | auto_increment |
| dateadded | timestamp(14) | YES | | NULL | |
| subject | mediumblob | | | | |
| body | longblob | YES | | NULL | |
| replytopost | bigint(20) unsigned | YES | | 0 | |
| aposition | tinyint(3) unsigned | YES | | 0 | |
| thrid | bigint(20) unsigned | | MUL | 0 | |
| usrid | bigint(20) unsigned | | MUL | 0 | |
| username | varchar(50) | | | | |
+-------------+---------------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)
the query should look like : select * from posts where thrid = 'the id of 
the thread' order by.....(this is the part i couldn't figure out);

the position of a single message into the tree is determined by the 
following criteria:
dateadded : the date in which it was added
replytopost: the post to which it belongs, if none then 0 is assigned
aposition: the absolute position of the message (horizontal)

a combination of these columns in an order by clause should (in theory) 
build the tree correctly
please advise me if i am doing something wrong here, i have tried many 
combinations without success


regards;

hassan


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to