Update / Delete / Insert quandry
| From: | Stuart Felenstein | Date: | Thu, 06 Jan 2005 15:28:32 +0000 |
| Subject: | Update / Delete / Insert quandry | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38007@lists.php.net to get a copy of this message | ||
I am working on "update" areas for my end users. This
is where they can go in and update and / or edit
information in their profile.
The problem I'm having a hard time getting my hands
around are those areas where they can have multiple
entries.
One of the tables allows for a user to enter up to 5
choices. The table would look like this:
RecordID TypeID
101 3
101 5
101 9
.........etc.
So I can do a straight update - where if they wanted
to update the example above and change the 3 to a 12
that works fine. What if they wanted to leave TypeID:
3 but delete 5 and 9. Or another scenario, if they
wanted to leave the existing ones but add a fourth
record.
Is there a way I can handle all this in one fell
swoop? I thought of "deleting" all current records
first and letting user make all new choices. Not sure
if this would work well if many users though.
Any suggestions ?
Thank you,
Stuart