How to get the data in the same location
Table A
ID name .....
11 Base Salary
13 Job Seniority Wages
17 Lesson Fee
If you sort by ID in ascending order, then the class fee is in the 3rd position, how to obtain the number 3, that is, how to get to the location of the tuition fee?
Table B
ID List
1 @@@
Then based on the obtained number 3, how to insert the content I want into the ID1 list in table B under the third [email protected]?
For example, I clicked on the Submit button below, [email protected], which made list into @@1000@
------Solution----------------------
Feel you should optimize your table structure ....
1, where the tuition fee is located
Database I don't know how to get it, but you are in the order, take out the loop to know its position (the starting value of the loop is 1)
2, insert list
You should take the list value first, organize it and then deposit the number According to the library
$s = ' @@@ ';//list original value
$arr =explode (' @ ', $s);
Array_splice ($arr, 3-1,1,1000);//3 is the position
Echo join (' @ ', $arr);
------Solution----------------------
Add a secondary field to table A or table B, so that the field corresponds to the natural order of the other table, and then it's easy to find @@@ and put 1000 in @@@
- -----Solve the idea----------------------
you click, go to the database to find the corresponding in the first (the array can be implemented), and then insert the B table on the line