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||bbmak@bbmak.com||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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.