I will try to be objective in the doubt:
I have the following code:
<?php
foreach ($modelo as $k => $v) {
$sql_ = "SELECT * FROM pedido WHERE modelo LIKE '%".$v."%' ORDER BY id ASC";
$disp_sql_ = $mysqli->query($sql_);
while ($data_ = $disp_sql_->fetch_array()) {
$quantidade_ += ($data_['total'] * $data_['kit']);
}
}
The total of the variable $quantidade
, has the output with sum, of all the models.
In the database it looks like this:
valor 1 = 20 ($modelo 1)
valor 2 = 30 ($modelo 1)
valor 3 = 50 ($modelo 1)
valor 4 = 50 ($modelo 2)
valor 5 = 50 ($modelo 2)
The variable $quantidade
brings me this:
$quantidade = 200;
What I would like is for you to bring me the result as follows:
$quantidade = array([0] => 100, [2] => 100)
A summation of each template change (every foreach change), results in an array.