$STH->setFetchMode(PDO::FETCH_ASSOC); $x = 0; while ($row = $STH->fetch()) { //print_r($row); $temp_journal = array(); $temp_journal['id'] = $row['id']; $temp_journal['id_journal'] = $row['id_journal']; $temp_journal['nom'] = $row['nom']; $temp_journal['type'] = $row['type']; $temp_journal['categorie'] = $row['categorie']; $temp_journal['datePublication'] = $row['datePublication']; $temp_journal['downloadPath'] = $row['downloadPath']; $temp_journal['coverPath'] = $row['imagePath']; $temp_journal['prix'] = $row['quantite']; $temp_journal['isSubscription'] = $row['until'] ? 1 : 0; $temp_journal['telechargementRestant'] = $functionObject->getNbTelechargementIssueForAchat($member_id, $row['id']); /* $bought_id = $functionObject->getBoughtIssueMembre($member_id, $row['id']); if($bought_id != NULL) { $temp_journal['bought'] = 1; } else { $temp_journal['bought'] = verifProductForAbonnement($row, $abonnementArray); } */ $json[$x] = $temp_journal; ++$x; } //print_r($json); //echo json_encode($json); echo json_encode(array("resultat" => "true", "data" => $json));