$tmp = array(); $tmp["id"] = $update["id"]; $tmp["locationIdFrom"] = $update["locationIdFrom"]; $tmp["locationIdTo"] = $update["locationIdTo"]; $tmp["estTimeToCross"] = $update["estTimeToCross"]; $tmp["situation"] = $update["situation"]; $tmp["description"] = $update["description"]; $tmp["timeOfSituation"] = $update["timeOfSituation"]; $tmp["updaterId"] = $update["updaterId"]; $tmp["updaterName"] = $update["username"]; $tmp["likeCount"] = $update["likeCount"]; $tmp["dislikeCount"] = $update["dislikeCount"]; $tmp["requestId"] = $update["requestId"]; $tmp["timeOfUpdate"] = $update["timeOfUpdate"]; array_push($response["updates"], $tmp); $likers = $db->getUpdateLikers($update); while ($liker = $likers->fetch_assoc()) { $tmp2 = array(); $tmp2["likerName"] = $liker["likerName"]; $tmp2["likerId"] = $liker["likerId"]; // array_push($response["updates"]["likers"], $tmp2); array_push($response["updates"], $tmp2); } $dislikers = $db->getUpdateDislikers($update); while ($disliker = $dislikers->fetch_assoc()) { $tmp3 = array(); $tmp3["dislikerName"] = $disliker["dislikerName"]; $tmp3["dislikerId"] = $disliker["dislikerId"]; // array_push($response["updates"]["likers"], $tmp2); array_push($response["updates"], $tmp3); }