$value) { # code... $query = "SELECT title FROM fileindex WHERE id = ? "; $file = PDO_FetchRow($query,array($value["doc_id"])); if($file){ $fileList[$key]["title"]=$file["title"]; } else{ $fileList[$key]["title"]=""; } } $output["file"] = $fileList; } } } echo json_encode($output, JSON_UNESCAPED_UNICODE); ?>