connect(); $project = new Project($db); $project->pid = $data->id; $result = $project->read(); $num = $result->rowCount(); $tempObject = new stdClass(); $tempObject->data = NULL; if ($num > 0) { $row = $result->fetch(PDO::FETCH_ASSOC); extract($row); $item = array( "id" => $pid, "name" => $name, "baseUrl" => $baseUrl, "liveAttributes" => $liveAttributes ? explode(",", $liveAttributes) : array(), "status" => $status ); $tempObject->data = $item; } echo json_encode($tempObject);