Not getting correct output as expected using JSON_encode
I want [THOMAS,THOMAS ]
but output comes [{"username":"THOMAS"},{"username":"THOMAS "}]
Below is the code, can anyone help me why I get Field name also along with the output
$json = array();
$testingarray = mysql_query("SELECT username FROM $tbl_nameweek where manager = 'James' ") ;
while($row = mysql_fetch_assoc($testingarray))
{
$json[] = $row;
}
$sendArray = json_encode($json);
echo json_encode($json);
OUTPUT IS : [{"username":"THOMAS"},{"username":"THOMAS "}]
$delimiter1 = "username";
$splitcontents = explode($delimiter1,json_encode($json));
$counter = "";
echo "\n";
foreach ( $splitcontents as $element )
{
echo "\n";
print $element;
}
I want output only Thomas, I don’t know why Database fieldname is also getting added to JSON array, can anyone tell how can I only retrieve Thomas from this JSON array