0
Hello, I have a PHP array with data coming from the database, so it’s not static data, it changes. I need to add the wrong passes, goal kicks, etc of each player and save in a variable, because I want to put in a graph. I have tried to do by array and json_decode, but only find examples of how to get key data, however my array has several values in each key.
{"dados":[
{"atleta":"Lavoisier","passeErrado":3,"chuteAgol":1,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier","passeErrado":3,"chuteAgol":1,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier","passeErrado":3,"chuteAgol":1,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier","passeErrado":3,"chuteAgol":1,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier","passeErrado":3,"chuteAgol":1,"perdida":1,"interceptacao":0},
{"atleta":"Bage ","passeErrado":1,"chuteAgol":0,"perdida":0,"interceptacao":1},
{"atleta":"Bage ","passeErrado":0,"chuteAgol":0,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier ","passeErrado":1,"chuteAgol":2,"perdida":1,"interceptacao":1},
{"atleta":"Bage ","passeErrado":0,"chuteAgol":0,"perdida":1,"interceptacao":0},
{"atleta":"Lavoisier ","passeErrado":1,"chuteAgol":2,"perdida":1,"interceptacao":1},
{"atleta":"Lavoisier ","passeErrado":0,"chuteAgol":1,"perdida":0,"interceptacao":1}
]}
This I have tried. I really want to add those numbers, extracting them for a variable. If the player is so-and-so, sum up all his wrong passes and save them in a variable. What you suggest you can do with a print_r() or a var_dump().
– Paulo Lara
@Paulolara The answer no longer does that?
– Woss
No. If I want to play the total action sum variable for each player, into a graph, I’m not getting this variable. The question is, how do I enter the sum of each player’s action into variables?
– Paulo Lara