I have a database with some data encoded in json format. I would like to output an HTML table but I ran into a snag when the particular piece of data in the json encoded data cell was an array. The word "Array" is output for the field in the HTML table along with "Notice: Array to string conversion in...".
My code uses a MySQL statement to retrieve data and the usual fetch array operators. The specific code used to render the json encoded data is:
$user_params = json_decode($row['params'], true);
and to create the output:
<td>{$user_params['phone']}</td>
<td>{$user_params['ride_catagory']}</td>
The first line above renders correctly since the data is encoded as a single text string, however, the second line gives me the "Array" and message since it is encoded as an array within the json data. How can I fix this?
Here is the contents of the 'params' database field:
{"phone":"444-336-5678","birth_year":"1965","volunteer":[""],"ride_catagory":["10-12","13-15","16 plus"],"ride_note":"on","membership_visible":"on"}