|
Posted by Johnny on 10/05/06 22:13
"Steve Shaw" <s.shaw@hccnet.nl> wrote in message
news:45255fe2$0$16479$3a628fcd@textreader.nntp.hccnet.nl...
> Hi
>
> I'd like to be able to scan through a file for a particular line that
> indicates the start of the data in the file, then load the lines
> thereafter (space separated variables) into mysql until i reach a
> specific line that indicates the end of the data.
>
> I know how to take the data from the file to mysql - but how can i best
> search through the file to find the starting point. anyh ideas on the
> best way to achieve this would be very welcome
>
> Thanks
> Steve
Bunch o ways to do that, mostly using string functions.
For instance:
$findme='that line content I'm looking for';
$posWIW = strpos($the_page, $findme); # WIW = what i want ;-)
if ($posWIW) {
# do more like:
# find the other end of what you want
# get the substr using something like substr($the_page,
$the_start, $the_end-$the_start);
# use explode() to get your vars from the subsr
# copy to mysql
} else {
# do error or whatever when not found
}
Navigation:
[Reply to this message]
|