prepare($sql_str); $stmt->bindParam(':id', $id); $stmt->execute(); $contract= $stmt->fetch(PDO::FETCH_ASSOC); $files_id = $contract['files_id']; $sql_str = "SELECT * FROM contract_back_files WHERE files_id = :files_id "; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':files_id', $files_id); $stmt->execute(); $files= $stmt->fetchAll(PDO::FETCH_ASSOC); $files = json_encode($files); $accounttype = "M"; $sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(":accounttype", $accounttype); $stmt -> execute(); $persons = $stmt->fetchAll(PDO::FETCH_ASSOC); $persons = array_map(function($person){ return [ 'view'=>$person['accountid'] .'-'. $person['name'], 'value'=>$person['accountid'], 'name'=>$person['name'] ]; }, $persons); ?>