RE: [PHP] Reading A file
| From: | Sven Jacobs | Date: | Wed, 06 Mar 2002 14:46:53 +0000 |
| Subject: | RE: [PHP] Reading A file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87464@lists.php.net to get a copy of this message | ||
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:fernando@camarascu.co.cu]
Sent: mercredi 6 mars 2002 15:13
To: Sven Jacobs; php-general@lists.php.net
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