diff --git a/code/submissions/SubmittedFormReportField.php b/code/submissions/SubmittedFormReportField.php index 09f8593..ac9074d 100755 --- a/code/submissions/SubmittedFormReportField.php +++ b/code/submissions/SubmittedFormReportField.php @@ -83,7 +83,11 @@ class SubmittedFormReportField extends FormField { // Get the CSV header rows from the database - $tmp = DB::query("SELECT DISTINCT \"Name\", \"Title\" FROM \"SubmittedFormField\" LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\" WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ") ORDER BY \"SubmittedFormField\".\"ID\""); + $tmp = DB::query("SELECT DISTINCT \"SubmittedFormField\".\"ID\", \"Name\", \"Title\" + FROM \"SubmittedFormField\" + LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\" + WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ") + ORDER BY \"SubmittedFormField\".\"ID\""); // Sort the Names and Titles from the database query into separate keyed arrays foreach($tmp as $array) {