Jump to content

Filter data from a flat database


bbmak

Recommended Posts

Hi,

I am first time using flat database.

 

I am trying to building a scheduler. I have finish with the insert part to the txt file.

However, on the get data part, I am trying to show the events for today.

 

here is how the data store in database.txt

Day of Insert the event||Day of Perform||Time||User||User Email||Events

2008-Jan-15_05:06:08PM||2008-01-19||12-13||bbmak||[email protected]||test

 

I want the scheduler only show today's tasks. May I know how do i sort that?

Let say I want to show only 2008-01-20 data.

 

 

Here is the code that i have so far

<?


$date = mktime(0, 0, 0, date("m"), date("d")+"$w", date("y"));
$today = date("Y-m-d", $date);


$Lines = file("database.txt");

foreach($Lines as $Key => $Val) 
{
   //explode that data into a new array:  
   $Data[$Key] = explode("||", $Val);
}

for($K = 0; $K < sizeof($Lines); $K++) 
{ 



   echo '<p>';   
   echo 'Schedule ID: ' . $Data[$K][0] . '<br>';
   echo 'Day: ' . $Data[$K][1] . '<br>';
   echo 'Time: ' . $Data[$K][2] . '<br>';
   echo 'In Charge Person: ' . $Data[$K][3] . '<br>';
   echo 'In Charge: Email: ' . $Data[$K][4] . '<br>';
   echo 'Event: ' . $Data[$K][5] . '<br>';
   echo '</p>';

}

echo $today;

?>

 

Link to comment
https://forums.phpfreaks.com/topic/87000-filter-data-from-a-flat-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.