I have the following arrays:
Array 1. Clients:
Array
(
[1] => Jose Perez
[3] => Pedro Paz
[7] => Andres Juarez
[9] => Jorge Hernandez
)
Array 2. Sales per store 1 customer:
Array
(
[1] => 10.00
[7] => 15.00
[9] => 30.00
)
Array 3. Sales per customer store 2:
Array
(
[3] => 11.00
[7] => 25.00
[9] => 50.00
)
I try to make a report like the following, where the last column shows the total sales per customer, with foreach but I have not been successful:
Help please!
As you present this (without any code...) It's wrong, the index is not well defined and in the first array the value should be enclosed in quotes ("").
Even so, I am going to show you a possible solution, everything and what you should show what you have done to prove that we are not doing you a task...
The first thing you should do is define the array that you are going to use well, once that is done you are going to create a 4th array where you will store all the information. Once prepared, what you are going to do is go through the arrays comparing the indices, if the first index agrees with the following ones that we go through, we will put this value in the 4 array and we will finish the loop in which we find ourselves, otherwise we will give it a value of 0.00, to finish we will add both sales and show them in table format.