This is my code:
foreach($total_columns as $value){
echo "<td><b>{$value}</b></td>";
}
Each $value is being echoed twice, one for the numerical key and one for the associative key. How do I stop this from happening?
This is my code:
foreach($total_columns as $value){
echo "<td><b>{$value}</b></td>";
}
Each $value is being echoed twice, one for the numerical key and one for the associative key. How do I stop this from happening?
I guess your array comes from a mysql record?
If so, then use mysql_fetch_assoc
there!
mysql_fetch_array would output =>
array
(
[0] => "1"
"foo" => "1"
[1] => "2"
"bar" => "2"
)
mysql_fetch_assoc outputs =>
array
(
"foo" => "1"
"bar" => "2"
)
This is probably, where your double entries come from. If so, see the docs here