Hi,
I’m reading a tab-delimited text file via PHP. This text holds an array of 13 elements. When the available column is less than or equal to zero, I highlight the entire table row in red. A new function I’m implementing is if the LECTURE to a science course has a lab component I added a Y/N column to the text file to check against. Here are the problems:
The yellow doesn’t highlight the LECTURE row when I have a Y value
If one of the science courses is closed, the other science times don’t remain yellow if they’re still open.
Here’s my code:
[code=php]<?php
$theFile=fopen(“branson_fall_test.txt”, “r”);
$firstLine=fread($theFile,19);
//error check to ensure we can open the text file and get results back, if not, display a //warning.
if(!$theFile)
{
echo “Couldn’t open the data file. Try again later.”;
}
else
{
//read the contents of the text file
while(!feof($theFile))
{
//split the tab delimited file up
$data=explode(“t”, fgets($theFile));
if (sizeof($data) == 13)
{
if ($data[12] == “Y” && $data[6]==”LECTURE”){
//-if you want the lab line to be yellow too then you could tack on a or here
//-if ($data[12] == “Yn” || $data[6] == ” LAB”){
print “<tr “;
print “class=”lab””;
print “>”;
}
else if ($data[5] <= 0 && $data[6] != ” LAB”){
print “<tr “;
print “class=”closed””;
print “>”;
}
else{
print “<tr>”;
}
for ($i=0; $i<12; $i++)
{
print “<td>$data[$i]</td>n”;
}
print “</tr>n”;
}
}
//done with the file, call the fclose function, passing variable
fclose($theFile);
}
?>
Here’s an address:
[url]http://midwestwebdesign.net/bransontest.php
It has to be something simple I’m missing, any tips would be appreciated.