Hi,
I am trying to display information from a CSV file where I want to show the rows where the information is contained within two rows containing the word of the current month. This works and shows as expected when manually inputting the values (141 and 157 in the code below), but I would prefer to define these values dynamically.
[php] echo “<table align=“center”>\n\n”;
$f = fopen(“STAMP HOLIDAY SICKNESS.csv”, “r”);
$i = 0;
$monthName = strtoupper(date(‘F’));
while (($line = fgetcsv($f)) !== false){
$i ++;
echo “
foreach ($line as $cell) {
do
{
if ($i >= 141 && $i < 157){
--PERFORM CODE HERE
}
}while(0);
}
echo "</tr>\n";
}
fclose($f);
echo "\n</table>";[/php]
I have tried to define the variables using the code below, but this obviously only creates one variable and gets overwritten by the latest value. Any suggestions how to do this would be much appreciated.
[php] do
{
if ($line[0] == $monthName)
{
$lineNo = $i;
echo $lineNo ."
";
}
}while(0);[/php]
Thanks for your help