-1

I'm trying to get data from my database with json_decode. Data:

[{"label":"Porra","ammo":0,"components":[],"name":"WEAPON_NIGHTSTICK"},{"label":"G17","ammo":72,"components":["clip_default"],"name":"WEAPON_COMBATPISTOL"},{"label":"Tazer X26","ammo":250,"components":[],"name":"WEAPON_STUNGUN"},{"label":"Linterna","ammo":0,"components":[],"name":"WEAPON_FLASHLIGHT"}]

My php code:

        <?php
                                $consulta2 = "SELECT loadout FROM users WHERE identifier = 'steam:".$hexsteam."'";
                                $resultado2 = mysqli_query($conn,$consulta2);
                                if ($resultado2) {
                                    while ($row3 = $resultado2->fetch_array()) {
                                    $id = $row3['identifier'];
                                    $armas = json_decode($row3['loadout']);    
                                    ?>
    <table>
        <tbody>
        <tr>
            <td style="background-color: #eff2f5; opacity: 1; box-shadow: inset 0 1px 2px rgba(0,0,0,.075); padding: 5px 15px; min-width: 300px; max-width: 300px !important; border-radius: 0px 0px 0px 0px;"><?php echo $armas?></td>
        </tr>
        </tbody>
    </table>
    <?php
                                        }
                                                        }
                                        
                            ?>

I can't get the data, the output its "Array"

Your Common Sense
  • 154,967
  • 38
  • 205
  • 325
Werkley
  • 1
  • 1

0 Answers0