Question about arrays
$P_Arr = mysql_fetch_array( $Res)
$ContentArr['headers'] = array();
$ContentArr['header_class'] = array('myclass1','myclass2','myclass3','myclass4');
$ContentArr['cell_attributes'] = array();
$ContentArr['cell_row_class'] = array();
$ContentArr['cells'] = array();
$FTableArr['rows'] = 3;
$FTableArr['cols'] = 5;
print_r( $P_Arr );
Array (
[0] => 1
[ID] => 1
[1] => XCC039-5026
[Serial_Number] => XCC039-5026
[2] => temp
[Log] => temp
[3] => 0000-00-00
[Date_Mfg] => 0000-00-00
[4] => 2008-05-06
[Date_Rec] => 2008-05-06
[5] => 33
[V_Reading] => 33
[6] => 8
[I_Reading] => 8
)
I have a for loop like this
$Cnt = 0;
for ($i = 1; $i <= $FTableArr['rows']; $i++ ){
$row = array();
for($j = 1; $j <= $FTableArr['cols']; $j++ ){
if( $P_Arr[$Cnt+8] == 0 )
array_push ($ContentArr['cell_attributes'], ' style="background-color: rgb(255, 255, 204); color: red; font-weight: bold;"');
else
array_push ($ContentArr['cell_attributes'], ' style="background-color: black;"');
//array_push ($row, "cell[Ri=$i,Cj=$j]");
array_push ($row, 'ET-'.$Cnt.'='.$P_Arr[$Cnt+2]);
$Cnt++;
}
array_push ( $ContentArr['cell_row_class'], ' style="color: blue; font-weight: bold;"');
array_push($ContentArr['cells'],$row);
$Cnt++;
}
The issue is
array_push ($row, 'ET-'.$Cnt.'='.$P_Arr[$Cnt+2]); #+2 is added to the counter because the data I want starts at the 2nd spot.
What I would like to do have the table name show up and then the value
array_push ($row, 'TableNameHere='.$P_Arr[$Cnt+2]);
So that the value of $row array would be for example
echo $row[4] ;#Date_Rec= 2008-05-06
Thanks for reading my question and hopefully it's not too confusing. The outputs from this go to a couple foreach loops which generate a table 3x5 cells in a template engine.