json_encode returning the next rows values - PHP PDO SQL HighCharts
问题 When trying to use json_encode from arrays in foreach() the data moves in to the next values, for example: I have this table which is coming from the same query + php: when using json_encode to try and fit this tables data in to highcharts, my outcome is like this: [{"name":"User1","data":[0,2,0,0]},{"name":"User2","data":[0,2,0,0,2,0,2,4]}] So it's moving User1's data in to User2's My desired outcome would be: [{"name":"User1","data":[0,2,0,0]},{"name":"User2","data":[2,0,2,4]}] This is my