for($j = 0; $j < 12; $j++) {
for($k = 0; $k < 8; $k++) {
$ln = $k + 1;
if(...) {
//Code for table edges like row and col names
//end code
} else { //Other cases
//switch statement, looks like
switch($j) {
case 2:
$keyname = $ln.'_FAR_INT';
break;
... //All cases are accounted for in this switch
}
foreach($data as $key => $val) {
if(strpos($keyname, $key) !== false) {
$cellVal = $key;
break;
} else {
$cellVal = '';
}
}
}
}
}
So the problem here is that the variable $ln
is stuck at 2 no matter what as soon as it hits a blank row. The first two columns have data from a database, and the third onwards have blanks in their relevant key/value pairs, so they're not returning null
, but
If you notice, it gets to 2_FAR_INT
, then does that forever until it hits the next row.
I don't know why it does this and debugging it has been a painful endeavor.
Dataset: Looks like {data: 1_FAR_INT, 2_FAR_INT, 3_FAR_INT, etc..., 1_TOTAL_BORN, 2_TOTAL_BORN, 3_TOTAL_BORN,...}
Why does $ln
refuse to increment appropriately to $k + 1
in every single case no matter what I tell it to do?