I am having a problem with this code. I looked into the issue and found no answer. When I run this code I get this:username1username2{"username":"Username1", "username":"Username2"}
Instead of the desired result:{"username":"Username1", "username":"Username2"}
Here is the code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$db = mysql_connect('localhost', '', '');
mysql_select_db("roblox");
$query = "SELECT * FROM `bans`";
$results = mysql_query($query);
while ($row_users = mysql_fetch_array($results)) {
//output a row here
echo $row_users['username'];
$users = array(
'username' => $row_users['username']
);
}
echo json_encode($users);
?>