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
You only select needed fields, so you can just do
echo json_encode($stmt->fetch(PDO::FETCH_ASSOC));
EDIT: You mention now that name is unique, so above is all you need.