. **/ if(isset($_GET['getprojects'])){ $sql=$db->prepare("SELECT p.id, p.name, p.description, u.username, p.path, p.repo, p.status, p.image FROM projects AS p INNER JOIN users AS u ON (u.id=p.owner) ORDER BY id DESC"); $sql->execute(); $projects=array(); while($row=$sql->fetch(PDO::FETCH_ASSOC)){ array_push($projects, json_encode($projects)); } echo json_encode($projects); }