Page 1 of 1

parsing filename and contents of the txtfile then insert

Posted: Mon Sep 20, 2010 12:52 am
by cyrus@php
hi to all...

does anybody has an idea of parsing the filename of the textfile and its contents and insert to database..

example..

format of the filename:
[date]

Code: Select all

 [time]

201089 1-111 93300.txt


contents of the text file:

12345 John Robinson
54321 Robert svenson


the table where the information should be inserted has this 
fields.. name of table: logs 

[ID]   [name]   [date]  [code]   [time]

say for example the parsing is done..it should look like this.


[ID]     [name]      [date]    [code]   [time]

12345  John Robinson 2010-8-9  1-111   9:33:00
54321  Robert Svenson 2010-8-9 1-111   9:33:000


how can i do that??
 can somebody help me?

thanks.