Re: Recursion with database tables
| From: | Jono Bacon | Date: | Wed, 19 Feb 2003 14:16:47 +0000 |
| Subject: | Re: Recursion with database tables | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136170@lists.php.net to get a copy of this message | ||
David Otton wrote:
On Wed, 19 Feb 2003 13:56:49 +0000, you wrote:JonoOne questions though - if I delete a topic, I need to delete all of its child messages and all of the child comments from each message. What is the best technique to do this? This has been driving me up the wall as it seems to involve some kind of looping and recursion.make sure /all/ your comments have the correct topicid set. Then simply "DELETE FROM comment WHERE topicid = x" Otherwise, yes, in MySQL you have to recurse down the tree deleting comments. How would I go about recursing down the tree? Has anyone done this before?