0
I have the code:
<?php
$d = json_decode($output);
?>
The variable $output sends json data to PHP. To better understand this variable, I will post the return of it
object(stdClass)#1 (6) {
  ["nome_1"]=>
  string(14) "Alisson Acioli"
  ["cpf_1"]=>
  string(11) "XXXXXXXXXX"
  ["nascimento_1"]=>
  string(10) "2014-07-19"
  ["nome_2"]=>
  string(14) "Alisson Acioli"
  ["cpf_2"]=>
  string(11) "XXXXXXXXXX"
  ["nascimento_2"]=>
  string(10) "2014-07-25"
}
What I want to do is make a loop with the returned data. I have show doing
<?php
echo $d['nome_1'];
?>
only that the screen turns white, nothing appears. In fact I would like to have _1, _2 be all [name], [Cpf] etc.. and I was looping after. The code that generates json is as follows:
<?php
$SQLResults = mysql_query("SELECT * FROM {$table} WHERE {$verificacao}");
                $i = 0;
                while($data=mysql_fetch_array($SQLResults)){
                    $i++;
                    foreach($this->dados["dados"]["show"] as $val){
                        $Resultados[$val.'_'.$i] = $data[$val];
                    }
                }
                echo json_encode($Resultados);
?>
Is json valid? is the same json as this question
– rray
Yes, it’s all as described.
– Alisson Acioli