Jump to content

Recommended Posts

 

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

 


 

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

Link to comment
https://forums.phpfreaks.com/topic/300847-explode-on-fields-of-excel-sheet/
Share on other sites

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.