deleting records into two tables... pls help... thanks

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Sun Jun 24, 2012 6:40 am

I think you're missing some of your code. I only see one delete query.

I would suggest that if you have two related tables and the PKs are different, that you make a third table to relate the two. This will let you look up one id from the other, which will make running the second delete query easier. If you create a foreign key relationship between this new table and the other tables, you can set the records to 'ON DELETE CASCADE', which will automatically remove the child rows. Alternatively, you could just add a third delete query to delete from the new table.

Post Reply