Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically parse data

Status
Not open for further replies.

maryer

IS-IT--Management
Jun 10, 2002
16
CY
Hi there, i would like to aske for your help for the following topic

site |*******down **** | *********up
site1 | 2001-12-23 00:39:22 | 2001-12-23 01:00:03
site1 | 2001-12-24 09:52:19 | 2001-12-24 10:15:34
site1 | 2001-12-24 11:49:14 | 2001-12-24 12:12:50
site1 | 2001-12-24 13:49:48 | 2001-12-24 15:01:51
site2 | 2001-12-24 15:50:17 | 2001-12-24 16:38:28
site2 | 2001-12-27 05:52:28 | 2001-12-27 07:40:42
site2 | 2001-12-27 11:13:34 | 2001-12-27 11:36:01
site2 | 2001-12-29 08:46:55 | 2001-12-29 09:12:54

this is my mysql table-downup, and i inserted data by writting
insert into dowup values ('site1', '2001-12-23 00:39:22', '2001-12-23 01:00:03')
insert into dowup values ('site1', '2001-12-24 09:52:19', '2001-12-24 10:15:34')
........ etc etc etc
where 'down' & 'up' data are taken from the uptime.html file:

uptime.html file on the screen
2001-12-23 01:00:03 : back_up
2001-12-23 00:39:22 : down
2001-12-24 10:15:34 : back_up
2001-12-24 09:52:19 : down
2001-12-24 12:12:50 : back_up
2001-12-24 11:49:14 : down

Now:

1) i need to do the same (transfer data to mysql table) automatically.
2) the highest date has to be on the top, the last one
3) to check if (back_up/up is true) then parse data, else if (!back_up) 'down' data don't parse.....

Should i use mysql command LOAD DATA INFILE in this case or not?

Thank you in advance

 
You're not going to be able to use LOAD DATA on that input file. The data needs to be in the exact form as it will appear in the table to be loaded that way.

But you could do a multi-stage load. Use PHP to pre-parse the data into a new text file with a more useful format, then issue LOAD DATA against that new file.

And don't worry about getting the data into the table in a specific order. That's what the ORDER BY clause of the SELECT query is for. Want the best answers? Ask the best questions: TANSTAAFL!
 
thank you for reply,
I just want to ask if i have to use file() functions and then string functions to transfer needed infomation (statistic into the mysql table?

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top