By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Parse CSV file

P: 1
I have a number of Tab-delimted files that I need to upload into mySQL server. The first two rows of the file is garbage and the next five rows is what I need to upload for each of these files. Each row has five columns. Additionally, I need to insert the file name also as a row.

I am envisioning a button to select and upload the data from each file into my database. Could anyone help me providing the code to build the program. Any help is appreciated.


Thanks in advance

-Naveen
Apr 25 '07 #1
Share this Question
Share on Google+
1 Reply


Motoma
Expert 2.5K+
P: 3,235
If this was in fact a CSV (that is Comma Separated Values) file, you could use the built in CSV functions that come with PHP.
If these are Tab Delimited, I would say the best route to go would be to read each line from the file and explode on the \t character.
You can get the uploaded file name from the $_FILES variable.

I have a number of Tab-delimted files that I need to upload into mySQL server. The first two rows of the file is garbage and the next five rows is what I need to upload for each of these files. Each row has five columns. Additionally, I need to insert the file name also as a row.

I am envisioning a button to select and upload the data from each file into my database. Could anyone help me providing the code to build the program. Any help is appreciated.


Thanks in advance

-Naveen
Apr 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.