On a game, there are three different teams. For example, team a, b, and c. On the game's database the playtime is reported like this: "[a,b,c]" and each letter is how many minutes the user has played on that specific team. I used PHP to grab the data from the database to display on a website, but it is just displaying as "[14,0,1]" as I have 14 minutes on team a, 0 on team b, and 1 on team c.
How can I format this, through PHP or JSON, to add a, b, and c, or in this case 14+0+1?
The code in PHP:
$sql = "SELECT * FROM players WHERE playerid ='". $steamprofile['steamid']
."'";
$result = $db->query($sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$playtime = $row["playtime"];
}
The code in HTML:
<span id="label">Playtime</span>: <b><span id="playerPlaytime"><?php echo
$playtime; ?></span></b><br>
Output: http://prntscr.com/jum85v