I'd like to be able to search for the array with the title Seattle, which will be set by a variable. Then return the x or y coordinate for that array. I've tried 5 or 6 different ways of trying to locate it without any luck.
This is the query I am using and how I am printing my array:
global $wpdb;
$myquery = $wpdb->get_row("SELECT * FROM wp_maps WHERE title = 'Test Map'");
$mymap = $mylink->data;
print_r($mymap);
This is the actual output.
{ "title":"USA", "location":"World", "levels":[ { "id":"states", "title":"States", "locations":[{"id":"bhAAG","title":"Seattle","description":"The City of Goodwill","x":47.6097,"y":122.3331},{"id":"biAAG","title":"Portland","description":"Portland, Maine. Yes. Life’s good here.","x":43.6667,"y":70.2667}] } ] }
Same output (formatted for easier viewing).
{
"title":"USA",
"location":"World",
"levels":[
{
"id":"states",
"title":"States",
"locations":[
{
"id":"bhAAG",
"title":"Seattle",
"description":"The City of Goodwill",
"x":47.6097,
"y":122.3331
},
{
"id":"biAAG",
"title":"Portland",
"description":"Portland, Maine. Yes. Life’s good here.",
"x":43.6667,
"y":70.2667
}
]
}
]
}
Any help would be appreciated.