You are here: Re: searching through a file and copying to mysql « All PHP « IT news, forums, messages
Re: searching through a file and copying to mysql

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация