0

I fetch data from MySQL and want to put them into Array and then JSON-Encode. The Code-Part is working fine, but i get two seperate JSON-Objects.

How to put them Into once? Like a "normal" JSON-Object.

while($row = mysqli_fetch_array($result))
 {
$Marke = $row["brand"];
     
$advert = array(
        'Marke' => $Marke,
     );
    echo json_encode($advert);
 }

This is the JSON-Encode-Result (two seperate JSON-Objects):

{"Marke":"Test1"}
{"Marke":"Test2"}
Fynn
  • 15
  • 5

0 Answers0