You shouldn't encode each row separately. Put all the results in an array, and then call json_encode
on that array when you're done:
while ($row = $result->fetch_assoc()) {
$statsArray[] = $row;
}
echo json_encode($statsArray);
Then in Javascript you need to loop over the returned array:
$.getJSON("phpscripts.php", {
"_player" : Player,
"_playerID" : UserID
},
function(returned_data) {
$.each(returned_data, function(i, e) {
var item_name = e.item_name;
var item_image = e.item_image;
$(".questItems").append(item_name + ", " + item_image + "<br/>");
});
};
);