JSON value encoded twice : how to use fetch_assoc()?
问题 The following code returns the value twice, once encoded in JSON : <?php $req = $bdd->prepare('SELECT Date, Open, Close FROM quotes WHERE Symbol = ? AND Date > ? AND Date < ?'); $req->execute(array($_GET['id'], $_GET['datemin'], $_GET['datemax'])); $test=array(); while ($donnees = $req->fetch()) { $test[] = $donnees; } echo json_encode($test); ?> [{"Date":"2012-02-29","0":"2012-02-29","Open":"88.14","1":"88.14","Close":"87.60","2":"87.60"},{"Date":"2012-02-28","0":"2012-02-28","Open":"87.83",