At 15:16 19.02.2003, Jono Bacon spoke out and said:
--------------------[snip]--------------------
>How would I go about recursing down the tree? Has anyone done this before?
--------------------[snip]-------------------- 

Given the DB layout I sketched before, you would:

1) delete all comments
delete from COMMENT 
    where id_message in (
        select id from MESSAGE where id_topic in $id_topic);

2) delete all messages
delete from MESSAGE where id_topic = $id_topic;

3) delete the topic
delete from TOPIC where id = $id_topic;

Wrap the whole stuff in a transaction if your database supports it and
you'll be fine.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to