CodeIgniter Many-to-Many Relationship Management -


Does any tutorial for a CodeIgniter from many databases?

Just try and prepare the process of making, and then update many-to-many relationships. My example uses multi-select values, thinking that you can update etc. How to monitor changes.

What do I want to share in my application? This is basically the same with my answer.

  1. After the user submits, and before entering the database, I will obtain the data in the database in an array. Example: $ collection = array ('111', '112', '113', '114'); (This is just for example. In fact, it should be brought from the database then enter the value for the array)
  2. I will examine the new user input in two steps The first step is to It is already in the database or not. If it is not, ignore otherwise ignore:
     foreach ($ input $ as input) {if (! In_array ($ input, $ archive)) {// insert here}} 
    < / Li>

Then in the second loop, I do it in reverse, which does the user to delete the data selected.

(archive as $ data) {if (! In_array ($ data, $ inputs)) {// do delete here}}

In your case, Loop may or may not be required. I need this since I input into the checkbox, that the user can choose to enable / disable, so I translate it as and insert it.

Since you apply it using multi-select, then basically it is with my checkbox

If you have an example of a structure or code, do not hesitate to share it, and I will help you fine tune (with my style, which may not be optimized yet or ).


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -