How can I design a mysql-phpexcel data import and import level-3 classification table to obtain the desired data format?

Source: Internet
Author: User
There are not multiple level-1 categories. level-2 categories. level-2 categories. level-3 categories are not certain. I want to get the relevant data combinations and write them to the database. but I don't know how to sort the data into the database. if you have time for the data, could you please help me? thank you! is there a way to get the value of the entire column...

There are not multiple level-1 categories. level-2 categories. level-2 categories. level-3 categories are not certain. I want to get the relevant data combinations and write them to the database. but I don't know how to sort the data into the database. right data
If you have time, please help me. thank you.

Is there a way to get the value of the entire column, then distinguish two columns based on the length, and then distinguish three columns?

The data obtained is in the format of 1 2 3 in the row...

Printed data on

Array (size = 16) 0 => array (size = 7) 0 => float 1 1 => string 'Salesman' (length = 9) 2 => string 'sales area 1 '(length = 10) 3 => string 'sales 1 department' (length = 13) 4 => null 5 => null 6 => null 1 => array (size = 7) 0 => float 2 1 => null 2 => null 3 => string 'sale 2 department '(length = 13) 4 => null 5 => null 6 => null 2 => array (size = 7) 0 => float 3 1 => null 2 => null 3 => string 'sale 3 department '(length = 13) 4 => null 5 => null 6 => null 3 => array (size = 7) 0 => float 4 1 => null 2 => null 3 => string 'sale 4 department '(length = 13) 4 => null 5 => null 6 => null 4 => array (size = 7) 0 => float 5 1 => null 2 => string 'sale zone 2 '(length = 10) 3 => string 'sale 1' (length = 13) 4 => null 5 => null 6 => null 5 => array (size = 7) 0 => float 6 1 => null 2 => null 3 => string 'sale 2 department '(length = 13) 4 => null 5 => null 6 => null 6 => array (size = 7) 0 => float 7 1 => null 2 => null 3 => string 'sale 3 department '(length = 13) 4 => null 5 => null 6 => null 7 => array (size = 7) 0 => float 8 1 => null 2 => null 3 => string 'sale 4 department '(length = 13) 4 => null 5 => null 6 => null 8 => array (size = 7) 0 => float 9 1 => string 'marketing department '(length = 9) 2 => string 'market area 1 '(length = 10) 3 => string 'market 1 department' (length = 13) 4 => null 5 => null 6 => null 9 => array (size = 7) 0 => float 10 1 => null 2 => null 3 => string 'market 2 department '(length = 13) 4 => null 5 => null 6 => null 10 => array (size = 7) 0 => float 11 1 => null 2 => null 3 => string 'market 3 department '(length = 13) 4 => null 5 => null 6 => null 11 => array (size = 7) 0 => float 12 1 => null 2 => null 3 => string 'market 4 department '(length = 13) 4 => null 5 => null 6 => null 12 => array (size = 7) 0 => float 13 1 => null 2 => string 'market zone 2 '(length = 10) 3 => string 'market 1 department' (length = 13) 4 => null 5 => null 6 => null 13 => array (size = 7) 0 => float 14 1 => null 2 => null 3 => string 'market 2 department '(length = 13) 4 => null 5 => null 6 => null 14 => array (size = 7) 0 => float 15 1 => null 2 => null 3 => string 'market 3 department '(length = 13) 4 => null 5 => null 6 => null 15 => array (size = 7) 0 => float 16 1 => null 2 => null 3 => string 'market 4 department '(length = 13) 4 => null 5 => null 6 => null

Reply content:

There are not multiple level-1 categories. level-2 categories. level-2 categories. level-3 categories are not certain. I want to get the relevant data combinations and write them to the database. but I don't know how to sort the data into the database. right data
If you have time, please help me. thank you.

Is there a way to get the value of the entire column, then distinguish two columns based on the length, and then distinguish three columns?

The data obtained is in the format of 1 2 3 in the row...

Printed data on

Array (size = 16) 0 => array (size = 7) 0 => float 1 1 => string 'Salesman' (length = 9) 2 => string 'sales area 1 '(length = 10) 3 => string 'sales 1 department' (length = 13) 4 => null 5 => null 6 => null 1 => array (size = 7) 0 => float 2 1 => null 2 => null 3 => string 'sale 2 department '(length = 13) 4 => null 5 => null 6 => null 2 => array (size = 7) 0 => float 3 1 => null 2 => null 3 => string 'sale 3 department '(length = 13) 4 => null 5 => null 6 => null 3 => array (size = 7) 0 => float 4 1 => null 2 => null 3 => string 'sale 4 department '(length = 13) 4 => null 5 => null 6 => null 4 => array (size = 7) 0 => float 5 1 => null 2 => string 'sale zone 2 '(length = 10) 3 => string 'sale 1' (length = 13) 4 => null 5 => null 6 => null 5 => array (size = 7) 0 => float 6 1 => null 2 => null 3 => string 'sale 2 department '(length = 13) 4 => null 5 => null 6 => null 6 => array (size = 7) 0 => float 7 1 => null 2 => null 3 => string 'sale 3 department '(length = 13) 4 => null 5 => null 6 => null 7 => array (size = 7) 0 => float 8 1 => null 2 => null 3 => string 'sale 4 department '(length = 13) 4 => null 5 => null 6 => null 8 => array (size = 7) 0 => float 9 1 => string 'marketing department '(length = 9) 2 => string 'market area 1 '(length = 10) 3 => string 'market 1 department' (length = 13) 4 => null 5 => null 6 => null 9 => array (size = 7) 0 => float 10 1 => null 2 => null 3 => string 'market 2 department '(length = 13) 4 => null 5 => null 6 => null 10 => array (size = 7) 0 => float 11 1 => null 2 => null 3 => string 'market 3 department '(length = 13) 4 => null 5 => null 6 => null 11 => array (size = 7) 0 => float 12 1 => null 2 => null 3 => string 'market 4 department '(length = 13) 4 => null 5 => null 6 => null 12 => array (size = 7) 0 => float 13 1 => null 2 => string 'market zone 2 '(length = 10) 3 => string 'market 1 department' (length = 13) 4 => null 5 => null 6 => null 13 => array (size = 7) 0 => float 14 1 => null 2 => null 3 => string 'market 2 department '(length = 13) 4 => null 5 => null 6 => null 14 => array (size = 7) 0 => float 15 1 => null 2 => null 3 => string 'market 3 department '(length = 13) 4 => null 5 => null 6 => null 15 => array (size = 7) 0 => float 16 1 => null 2 => null 3 => string 'market 4 department '(length = 13) 4 => null 5 => null 6 => null

Read the data in the Excel file to a two-dimensional array, so you don't need to be taught. the following code is directly used.


  

The program running result is:

Array
(

[Sales department] => Array ([sales area 1] => Array ([0] => sales 1 department [1] => sales 2 department [2] => sales 3 Department [3] => Sales Department 4) [sales zone 2] => Array ([0] => Sales Department 1 [1] => Sales Department 2 [2] => Sales Department 3 [3] => sales 4 department )) [marketing department] => Array ([market area 1] => Array ([0] => Market 1 department [1] => Market 2 department [2] => Market 3 Department [3] => marketing department 4) [market zone 2] => Array ([0] => Market 1 department [1] => Market 2 department [2] => Market 3 Department [3] => Market 4 department ))

)

My practice is to mark cat1, cat2, and cat3 from the column of classification, and then use a for loop in the background.

The data in the desired format can be obtained based on the adopted data. However, it is still difficult to determine the data to be operated, or it may not be able to determine its parent level for example, level-3 classification. if there is no such thing, it cannot be determined. you can only determine whether or not to add a subset. if not, you can add a new general feeling. the format of this requirement still needs to be adjusted. some problems exist. I may be using less strict internal requirements. the required format is still unavailable.

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.