Log in

View Full Version : Insert and delete - is this possible?



Gary Clutterbuck
02-06-2009, 04:17 PM
Hi,
I have created a site using Adobe Dreamweaver Developer Toolbox using PHP and MySQL.

I have one table in which the user can tick a field to indicate that they have no family members at their address.

If the person decides at a later stage that family members do reside at their address, I want the user to be able to add family members in a related table.

Is it possible to delete the record in the first table, if one or more family members are added in the related table, and for this to be done automatically when the first family member record is added? If it is possible, I'd be extremely grateful if you could point me in the right direction.

Many thanks,
Gary

zeromadpeter
02-09-2009, 06:09 PM
im not sure how your storing the data but you could update the first table to mark they have family members at the address.



1st table
name,familymembersataddress,sysid
bob 1 E101

2nd table
ataddress,name,sysid
E101 james F212

then you can check if familymembersataddress is 1 or 0 before looking for them in the 2nd table

Gary Clutterbuck
02-09-2009, 09:38 PM
Thanks for the reply - its appreciated. I'll give your suggestion a try.

Gary