Assistance with updating data with dependancies

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
freefall
Forum Commoner
Posts: 48
Joined: Sun Jun 18, 2006 3:55 am

Assistance with updating data with dependancies

Post by freefall »

I have 2 tables, one purely exists to satisfy a 1 to many relationship with the main table called: role.

To perform the inserts I perform this process:

Intert into role - return the row id
Create new entries into table 2 using values from a multi select list and linking this value to the role id.

Simple and neat.

Now, the question:

when I wish to update the data what would be the best practice to do this?

I have 1 major idea atm: update the role document, delete all previous entries for that role in table 2, then perform an instert.

Now this has drawbacks such as what happens imbetween the delete and the insert, and jsut generally doesnt feel right.

Any ideas?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Can you show us some sample data before and after the update?
(#10850)
Post Reply