How do I add an array to another? I mean addition, not to add the elements at the end of the array. I have a while structure and I want it to add the values at each iteration.
Tried a few variants like $final_array += $final_array; but I couldn't find a solution and I don't really know how to spell it to find something on SO/Google.
Here is the code:
<?php
$i = 0;
while ($i < 10){
$i++;
$sql = "SELECT * FROM parteneri WHERE nr_intrebare = '$i' AND varianta_raspuns = '$intrebare_01'";
$result = mysqli_query($con, $sql);
$final_array = array();
while ($row = mysqli_fetch_array($result))
{
$final_array[] = $row;
}
}
Edit:
To clear things up, I have a questionnaire that has 10 <select> fields. Here is an example:
<select name="intrebare_01">
<option selected="true" disabled="disabled">Selecteaza o optiune...</option>
<option value="A">Fotbal</option>
<option value="B">Tenis</option>
<option value="C">Basket/Handbal/Hockey/Volei</option>
<option value="D">Alte sporturi</option>
</select>
As you can see, each option has a value ranging from A to D.
I have a table called "parteneri" that contains the points of each of these values for each question. If you need the value in points of the question 4 answer B you can find it there.
The "parteneri" (partners) table has the following structure:
As you can see, there is a numeric value for each option for each of the seven partners.
What I need to do is to add the points each of these partners gathered after processing all of the 10 <select> and display the first three that got the most points.
Please ask if you have any questions that I didn't covered.

$final_arrayshould look like at the end?