prepare("UPDATE location SET description= :description, defect = :defect WHERE id= :id"); $stmt->bindValue(':description', $strDescription); $stmt->bindValue(':defect', $numDefect); $stmt->bindValue(':id', $id); $r=$stmt->execute(); // Store File Upload if ($boolUploadOk) { $strSQL="INSERT INTO files (loc_id,filename,filesize,filetype) VALUES (:loc_id,:filename,:filesize,:filetype)"; $stmt = $db->prepare($strSQL); $stmt->bindValue(':loc_id',$id); $stmt->bindValue(':filename',$filename); $stmt->bindValue(':filesize',$filesize); $stmt->bindValue(':filetype',$filetype); $stmt->execute(); } $result = array( "id" => $id, "description" => stripshlashes(nl2br($strDescription)), "defect" => $arrDefect[$numDefect], "filename" => $filename, ); echo json_encode($result);