Sql fiddle for your convenience here.
I\'m taking data from a MySql table and turning it into a json array. All works well and I have the output the way I want it, but i
$row = $stmt->fetch(PDO::FETCH_ASSOC); echo json_encode($row);
You don't need the while loop, if you only have one row in your result.