Why doesn't MySQL upload my data properly?

How do I export data from an Excel sheet into a MySQL database? Is data to be inserted into different tables instead of a single table using the upload button from the PHP/HTML page?

  • Answer:

    In Mysql workbench, you can create the table and then use the import button to import csv files.

Jason Loveman at Quora Visit the source

Was this solution helpful to you?

Other answers

First make sure you save your Excel file as CSV. Consider that you have data for serial no, name and course info. You wish to put them into tables. Here is a simple example code to do that: $source = fopen('student-info.csv', 'r') or die("Problem open file"); while (($data = fgetcsv($source, 1000, ",")) !== FALSE) { $sno = $data[0]; $name = $data[1]; $courses = $data[2]; mysql_query("INSERT INTO `stable` (`sno`,`name`) VALUES ('".$sno."','".$name."') "); mysql_query("INSERT INTO `coursetable` (`sno`,`courses`) VALUES ('".$sno."','".$courses."') "); } fclose($source);

Sushant Hiray

LOAD DATA LOCAL INFILE 'C:\\temp\\yourfile.csv' INTO TABLE database.table FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (field1, field2); this may help

Bikash Dash

Export the file to a CSV. Then Upload if the table matches the structure of the CSV, you're done.If not, you'll need to upload the xls and use a server side language to parse it out and save it.

Bastien Koert

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.