So i am trying to take a while loop and add values to an array. In the end I want to display the Item, #number of each Item and the Total amount for each item.
Example
$count_array = array();
// This is what i have working. Now I need to add the amount that this item cost
array_push($count_array, trim($item));
// I currently take out the item name and how many total for each item.
foreach (array_count_values($count_array) as $k => $v) {
echo "<tr><td align='center'>";
echo "$v";
echo "</td><td colspan='5'> ";
echo "$k";
echo "</td></tr>";
//echo "\$a[$k] => $v.\n";
}
// I need to add this to the array above so I know how much each item costed so i can add it up in the end to figure out total cost.
$item_row_total = $row['invoice_dtl_item_retail'] * $row['invoice_dtl_quantity'];
My data now looks like this
4 Announcements
1 Student
5 Store
1 Supply
17 Voting
What i want to do is have it say
4 Announcements $400
1 Student $50
The dollar amount would be the cost of each item. So Announcments in this example is $100 each adding to $400 and Student is $50 each adding to $50