I have been given a textfile which contains data on time sheet. That line contains a name and a department and their time out/in.The code below allows me to display the entire textfile but I want to read in the values by name and department from file and want to display that .
<?php
$file = fopen("C:\Bhrugisha mam.txt","r") or exit("Unable to open file!");
while(!feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
this is some data from my text file…
VCANTECH - Log Report
6 Bhrugisha Shah
Hr
Department: HR
August, 2011 Page 1 of 2
-----------------------------------------------------------------------------------------------------------------
Date : 01/Aug/2011 Shift : 1 ( 9:30:00 AM To 6:30:00 PM )
LOG TIME : 9:23:00 AM LOG TYPE : IN
LOG TIME : 1:55:00 PM LOG TYPE : OUT
LOG TIME : 2:18:00 PM LOG TYPE : IN
LOG TIME : 6:45:00 PM LOG TYPE : OUT
This should get you there
I would recommend making some edits to the regex’s, as I just copy and pasted the spaces. [\s]{1,} can be used in place of the crazy spaces 😛