Reply to Re: How to filter date from flat file with epoch date/time?

Your name:

Reply:


Posted by Rik on 01/19/07 14:31

H@C0 wrote:
> Hi,
> I have a flat file db with epoch date/time like:
>
> London || Bill F. || email-1 || 1169062557
> Paris || Pierre E. || email-2 || 1169069471
> Berlin || Hans K. || email-3 || 1169062557
> London || Harry W. || email-4 || 1168980047
> Madrid || Juan G. || email-5 || 1168897934
> Paris || Paul R. || email-12 || 1168976753
> London || James T. || email-6 || 1169115499
> Rome || Anna R. || email-7 || 1169057316
> London || Jack K. || email-8 || 1169066228
> Paris || Jacques Y. || email-9 || 1168979907
>
> I only want to display the records of a certain date, in this case
> 17-01-2007 (d-m-Y)
> Can anybody give me a hint?

Unfortunately, due to the double character delimiter, fgetcsv() is out of
the question. A pity.

For flat file db's look at SQLite :
http://nl2.php.net/manual/en/function.fgetcsv.php
http://sqlite.org/

That way, you can use more or less normal SQL to get what you want.

If all that is not possible, we'll have to do it the cumbersome way:

$records = array();
$date = '17-01-2007'
$handle = fopen('db_file','r') or die('could not open file';
while($result = fscanf("%s || %s || %s || %d\n")){
if(date('d-m-Y',$result[3]) == $date) $records[] = $result;
}
var_dump($records);
--
Rik Wasmus

[Back to original 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

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