PHP script to import csv data into MS SQL Server table
Could any person help me with a sample PHP script to import data from csv file into MS SQL Server.
The file has six columns while the table has eight columns. So, I have to modify the file to include two columns and thier values first, then import the file into SQL Server table.
Any suggestions please.
Please see below the issue that I am looking for a solution.
I have a record form with three text boxes:
Customer Name: C048468145-2 //substr () from filename without extension
Customer file: C048468145-2.csv //substr () from filename with extension
Data File: C:\C048468145-2.csv //filename selected by user
(a) Append extra two column names(Customer Name, Customer File,) to the begining of the column row in the (C:\C048468145-2.csv) file.
They are extra columns names that are required in the file and I will get the values from two textboxes before insert into a table.
After Appending the extra columns = : Customer Number,Customer File,Item,Product Number,Product Type,Date,Time,Stock Number,Cost GST$
// 9 columns after append.
(c) Append value (C048468145-2) for Customer Number and (C048468145-2.csv) for Customer File columns for each record and insert the record into Customer_Items table. So, the during the import, the record should kind of take this format: