How to get the data in the same location

Source: Internet
Author: User
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
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.