Skip to content
Advertisement

why there is an extra record stored in mysql database?

i created a csv to mysql database importer. Code-

JavaScript

And form code is –

JavaScript

But, the record should looks like this- enter image description here

So, i marked red , the unexpected data. I cant find out why it shows like that? any errors in code?

Advertisement

Answer

You need to skip the header row of your CSV file. Just don’t execute the SQL statement for the first row.

Your corrected code should look something like this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement