Hello Mate, I just want to ask some advise on how to do this functionality. How do i insert another item/s to an already inserted set. for for example cleaningID section cost estimateID ---------------------------------------------------------------- 1 1 150.00 E08202016-01 2 2 50.00 E08202016-01 I want another item to be added with the same estimateID so, i want to add: cleaningID section cost estimateID ---------------------------------------------------------------- 3 1 70.00 E08202016-01 In the first glance it is easy to do as i will just need to use insert on this but the twist is, when i need to edit a set it will populate this three rows on my form, but then when i need to add another item from editing it will create another estimateID. How do i implement adding an item to an already created id Thank you
The problem is with your form rather than the database I think. Look at your hidden variables and what you are actually inserting.
I think what i need is sort of array push functionality... which is used to add an item to an array... my problem is how can this be applied in mysql...
The database is not the problem. The form is, as @sarahk stated. When pulling information for editing, also pull the estimateID - then, when pushing back/saving the edit, adding a new row, save it with the estimateID - if no estimateID is provided, create a new ID. It is not that hard, but it all depends on how the update/insert form(s) are created. Normally, you would have a list of existing rows in an overview, and then, you'd chose to either edit an existing row, update an existing offer (estimateID) or create a new estimate alltogether. Depending on what you pick to do, the form you use will update accordingly. So for editing an existing row, you just do an update on the selected row(s) (based on existing ID, not the estimateID) - if you want to add to an already existing estimateID, you would need to do an insert, but base that insert on the already existing estimateID. For creating a new estimateID, that is fairly easy, by just using what you have now.