First, here's a look at the page:
I've got a table that consists of 83 cells. The number of rows corresponds to the data that is in a temp table. The idea is to query each cell and see if there's data in it. I'm doing that with this:
for($i=1; $i<=$number_of_rows; $i++)
for($y=0; $y<=83; $y++)
//here is where you define the content, the colspan and the style of the cell. Bear in mind that you'll have to close the cell at this point as well
$statement = $mssql_pdo->prepare("select * from gant_table where DataDisplay_Row='$i' AND DataDisplay_StartCell='$y'");
if (count($results) > 0)
//echo "select * from gant_table where DataDisplay_Row='$i' AND DataDisplay_StartCell='$y'";
foreach($results as $row)
//$body.="</td>"; //BTW you're good up to here
} // this closes your foreach dynamic
} //this closes your results question
So, my logic is:
Loop through each cell and query the database to see if there's data that corresponds to that cell / row number
If there's data, print the background color
If there's no data, simply print an empty cell
I'm having trouble in that if you look at my graphic, just below the two big, black errors, you'll notice the sequence of my $y variable "skips." It goes from 31 to 33 and on the same row it skips again from 66 to 68.
Why? Why doesn't cell 32 or 67 show up?
Here's the data as it appears in the database:
You see two entries, both on row one. One has a data start cell of 0, the other has a start cell of 33. I can't understand why my "logic" skips right over cells 32 and 67.