shadow-walker Posted February 19, 2016 Share Posted February 19, 2016 how would it explode on the fields of an Excel file for import into a mysql table, because the next step of my dìsarebbe this function code: $ Uploaddir = getenv ( 'XLSX_STORE'). Basename ($ file); switch ($ filetype) { "WALL" houses: rename ($ file, $ uploaddir); echo "Upload succesfully!" file; try { $ InputFileType = PHPExcel_IOFactory :: identify ($ filetype); $ ObjReader = PHPExcel_IOFactory :: createReader ($ inputFileType); $ PhpExcel = $ objReader-> load ($ excelfilepath); $ Sheet = $ phpExcel-> getSheet (0); } Catch (Exception $ e) { echo $ e-> getMessage (); } $ = $ Highestrow sheet-> getHighestRow (); $ = $ Highestcolumn sheet-> getHighestColumn (); $ ColumnCount = PHPExcel_Cell :: columnIndexFromString ($ highestcolumn); $ Titles = $ sheet-> rangeToArray ( 'A1:'. $ Highestcolumn. "1"); $ Body = $ sheet-> rangeToArray ( 'A2:'. $ Highestcolumn. $ Highestrow); $ Table = array (); for ($ row = 0; $ row <= $ highestrow - 2; $ row ++) { $ A = array (); for ($ column = 0; $ column <= $ ColumnCount - 1; $ column ++) { $ A [$ titles [0] [$ column]] = $ body [$ row] [$ column]; } $ Table [$ row] = $ a; }?> <Table class = "table table-bordered"> <? Php $ Sheet = $ phpExcel-> getSheet (0); $ = $ HighestColumn sheet-> getHighestColumn (); $ = $ HighestRow sheet-> getHighestRow (); for ($ row = 1; $ row <= $ highestRow; $ row ++): $ = $ RowData sheet-> rangeToArray ( 'A'. $ Row. ':'. $ HighestColumn. $ Row, NULL, TRUE, FALSE); ?> <Tr> <? Php foreach ($ rowData [0] as $ col):?> <Td> <? Php echo $ col; ?> </ Td> <? Php endforeach; ?> </ Tr> <? Php endfor; ?> </ Table> <? Php break; default: echo "Files do not readable"; } } $ Query =? that is, once it was recognized that the file is called wall_ and was then imported into XLSX_STORE, the excel sheet data are organized into an array of arrays hash which then generates a table html, now I want to import this data to 'interior of a mysql table but that is unpacked http://i.stack.imgur.com/9yrC1.jpg This is the excel as you can see the first field is to be imported as you see it in one piece, but then the second and the third are unpacked ie data / model / type shall be divided and power is also divided into two, how would you? thank you, the connection to the db is already made so I just need the query, even infinite thanks Quote Link to comment https://forums.phpfreaks.com/topic/300847-explode-on-fields-of-excel-sheet/ Share on other sites More sharing options...
ginerjm Posted February 19, 2016 Share Posted February 19, 2016 Interesting syntax - perhaps you can explain it to me since I have not seen it used before: $ = $ Highestrow sheet-> getHighestRow (); $ = $ Highestcolumn sheet-> getHighestColumn (); Not the use of variable names with a space after their $ character, but the simple attempt to assign a value to a thing named "$". What does that do? Quote Link to comment https://forums.phpfreaks.com/topic/300847-explode-on-fields-of-excel-sheet/#findComment-1531278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.