0

So i have this php code:

while( $record = mysqli_fetch_assoc($result) )
{
    echo "<pre>";
    print_r($record);
    echo "</pre>";
}

and it gives me this result:

Array
(
    [id] => 1
    [password] => password123
)

But how can I format this sql response into json? Example:

{
  "id": 1,
  "password": "password123"
}
CrisDev
  • 11
  • 3

0 Answers0