New to php. I am trying to send JSON data to front end in name-value pair. I tried an example which I got here The following is my code fragment which sends the data in JSO
Your list array is only storing 1 row. Try this:
while ($stmt->fetch()) { $list[] = array('id' => $fid, 'name' => $fname); }
Hope this helps!