parsing filename and contents of the txtfile then insert

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cyrus@php
Forum Newbie
Posts: 1
Joined: Wed Sep 15, 2010 8:20 pm

parsing filename and contents of the txtfile then insert

Post 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.
Post Reply