0
I need to take the value of two different arrays and put in the database, I tried with the code below, but I’m having difficulty to separate the two values and add each of the values to their respective database fields.
<?php
$array = array(12.1, 12.3, 18.32, 12.45, 1.5, 1.5);
$array2 = array(12.3, 2.3);
foreach(array_combine($array, $array2) as $key => $media) {
$media = str_replace(",",".",$media);
$media_total = str_replace(",",".",$media_total);
var_dump($key, $media);
var_dump($key, $media_total);
}
?>
Why don’t you make a loop for each one?
– GilCarvalhoDev
Has you in the array?
– Ivan Nack
Respective table or meant respective fields?
– GilCarvalhoDev
I meant in the fields
– Julia Campos
One array has the simple media value and the other has the calculation with all medias
– Julia Campos
How do you need these values to be placed in the bank? Do you have any standards?
– Guilherme Nascimento
do not understand you have 2 arrays, have two variables $media and $media_total this with difficulty to average or put in the bank the value of variables?
– SneepS NinjA
My difficulty is in recovering the value of the two arrays, I can only recover from one
– Julia Campos