Ok I have a file like this and a want to isert this into a mysql table
It has to be 
field Date      data Mar 06 15:45:24
field bksvr buops
field Message NetWorker Savegroup: (alert) Manutan aborted, 2 client(s)
(manutan-pre01, manutan-omct Failed)

Log file 
Mar 06 15:45:24 buops: NetWorker Savegroup: (alert) Manutan aborted, 2
client(s) (manutan-pre01, manutan-omct Failed)
Mar 06 15:45:24 buops: Start time:   Wed Mar 06 15:42:01 2002
Mar 06 15:45:24 buops: End time:     Wed Mar 06 15:45:24 2002
Mar 06 15:45:24 buops: --- Never Started Save Sets ---
Mar 06 15:45:24 buops: savegrp: manutan-pre01:index index was never started

-----Original Message-----
From: Ing. Fernando Proll Segura [mailto:[EMAIL PROTECTED]]
Sent: mercredi 6 mars 2002 15:13
To: Sven Jacobs; [EMAIL PROTECTED]
Subject: Re: [PHP] Reading A file



> Hey
>
> I have a TEXT file that I want to make visual via the web using php
>
>
>

Maybe this isn't the best way but to do this I use the following code:

<?php

function do_print($item2,$clave) {
    echo $item2."<BR>";
}

$lines=file("yourfile.txt");

array_walk($lines,'do_print');

?>

As you can see I use the file() function to get each line of text into an
array and then the function array_walk() to do the visualization.

Hope it helps!

Fernando

Reply via email to