Re: How to Delete the parent node, and child nodes/leafs for a db/tbl in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/10/16 bruce <bedouglas@xxxxxxxxxxxxx>:

> I've got a situation where I have a couple of tables. The relationship
> between the tables is one of parent/child. I'm trying to figure out the best
> approach to being able to delete the associated children in the child tbls,
> of a given parentID in the parentTBL...
>
> I've checked into various sites/articles on the 'net.. but i'm not sure how
> best to accomplish this...
>
> I'm using php as the interface language to the test tbls..
>
> Any pointers/articles/test code (code/schema) would be helpful...

This is a DB question not a PHP question, plus you haven't told us
what database and table type you're using.

However, you can either delete the relationship yourself (using PHP
code), write a trigger to do it semi-manually, or set your database up
properly with a foreign key constraint.

Assuming you're using MySQL and your table type supports foreign keys,
see http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux