hello all
How to import file Excel to database MySQL with code PHP? Please show me, thanks for Help!!!

    Have you heard about google yet? It's a fine tool for searching for like "php excel read".
    When you find tons of script on how to read from excel files with php then look for "mysql insert tutorial php" and learn what to do with the data you have read from xls file.
    If the scripts for excel reading won't work properly for you, you can use COM objects to access real excel application and read through it (but only if your server is windows based and has excel installed) - but that's a little tricky.

      best thing I do is import it manually, export a tab delimited file from excel
      that will produce a simple txt file readable in PHP

      I then read the file in PHP
      run a loop for each line in the file which will correspond to each entry in the excel file and explode the line by "TAB" that way I insert only the information I want.
      At this point you can either: run a sql INSERT statement for each line, which is the easiest but slowest way if you have alot of records

      or put that withitng another loop to group value sets for entry
      That should pretty much take care of it

        Write a Reply...