I'm fetching table data from a mysql database using PHP. One of the fields in the database (memberProperties) is an array of data that gets outputted like this:
{
"title":"-",
"first_name":"Joe",
"last_name":"Bloggs",
"role":"Senior Scientist",
"phone":"61240 652135",
"start_date":"2016-05-20",
"leave_date":"2016-05-20",
"location":null,
"team":"Engineering",
"platform":"Rockets",
"username":"joe.bloggs",
"from_ad":"true",
"full_name":"Joe Bloggs",
"display_name":"Joe Bloggs",
"mobile":null,
"company":"ACM WIDGETS"
}
How do I cycle through each value and assign a variable that can be reused in the page? I have tried to do the following according to a w3schools PHP tutorial... but it doesn't seems to output the values separately.
$my_array = array($row["memberProperties"]);
list($title, $first_name, $last_name, $role, $phone, $start_date, $leave_date, $location, $team, $platform, $username, $from_ad, $full_name, $display_name, $mobile, $company) = $my_array;
echo "$title, $first_name, $last_name, $role, $phone, $start_date, $leave_date, $location, $team, $platform, $username, $from_ad, $full_name, $display_name, $mobile, $company";