You are here: Re: Flat file db. Only display records of unique field data. « All PHP « IT news, forums, messages
Re: Flat file db. Only display records of unique field data.

Posted by Geoff Berrow on 12/08/06 13:51

Message-ID: <k0qin25f9pbn22f1ui1dnc3guk7enuio0t@4ax.com> from H@C0
contained the following:

>I am using a flat file database like:
>
>London || Bill F. || email-1
>Paris || Pierre E. || email-2
>Berlin || Hans K. || email-3
>London || Harry W. || email-4
>Madrid || Juan G. || email-5
>
>I only want the records being displayed of the city of London (field1),
>not using a search command.

Don't know what you mean about not using a search command.

Something like this will display all records containing "London"

$search="London";

$data=file("data.txt");

foreach ($data as $row){
$field=explode("||",$row);
if(strpos($field[0],$search)!==false){
echo $row,"<br>";
}
unset($field);
}

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

 

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

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