I'm using a php library from https://sourceforge.net/p/wowarmoryapi/home/Home/. It pulls json data from battle.net and stores it in my database for cache reasons.
code to get json from db (I'm not sure if it's still considered json at this point):
$data = $con->query('SELECT Data FROM wa_guilds');
I use the following code to see the data:
foreach($data as $row) {
echo "<span style='color:#ff0099'>";
var_dump($row);
echo "</span>"; }
which looks like this minus the errors, that's from another code:

I've tried various methods, mostly from this site to show my data in a way that's easy to read but I always get error.
- This is definitely an object.
if (is_object($data)) { echo "yay!"; }<--this works - Once I use
$decodedjson = json_decode($data);it's no longer an object and I can't seem to print the results to see what it looks like. var_dump($decodedjson) returns NULL
Finally, when I use the following code:
foreach ($data as $da){
echo $da['Data']['character']['name']; }
returns Warning: Illegal string offset 'character'
and:
foreach ($data as $da){
echo $da['character']['name']; }
returns Notice: Undefined index: character
I don't understand what I'd doing wrong, or right. Do I need to somehow turn $data into a string?
NEW CODE
$sth = $con->query('SELECT Data FROM wa_guilds');
$sth->execute();
$data = $sth->fetchAll(PDO::FETCH_ASSOC);
foreach($data as $row) {
foreach($row as $r) {
$myData = json_decode($r, true);
echo "<span style='color:#ff0099'>";
var_dump($myData['Data']);
echo "</span>"; } }
NEW ERROR
NULL NULL
var_dump($data);right after the$data = $con->query()line? I'm guessing that you are trying to loop on a query reference, instead of the query results.object(PDOStatement)#2 (1) { ["queryString"]=> string(26) "SELECT Data FROM wa_guilds" }var_dump($data)?