Edit similar fields in codeigniter

0

Imagine the following situation: Registered in a database of several telephones of a single establishment (local_1, +55 xx xxxx-xxxX; local_1, +55 xx xxxx-xxxY; ...);

The problem: Enable the user to edit these various phones (this includes add and remove) and save in the database it.

I thought of listing the phones and in case of a change, clear the old phones from the database and add everything again (the modification)

Any suggestions to help me?

    
asked by anonymous 03.06.2014 / 05:54

1 answer

1

I imagine you have an establishment table and a telephone table, correct?

I recommend making this so your data is (minimally) #> normalized .

Once you have these two tables, you can determine through a unique identifier for each phone which phone record you are effectively editing or removing, via # or any other key that you consider relevant (ddd + number?).

With this unique identifier, you do not have to remove all other phones, but only change the phone number identified by that value.

    
03.06.2014 / 06:05