diff --git a/code/formfields/FieldEditor.php b/code/formfields/FieldEditor.php index cf20545..ba29034 100755 --- a/code/formfields/FieldEditor.php +++ b/code/formfields/FieldEditor.php @@ -188,9 +188,9 @@ class FieldEditor extends FormField { $sqlQuery = new SQLQuery(); $sqlQuery = $sqlQuery - ->setSelect('MAX(Sort)') - ->setFrom("EditableFormField") - ->setWhere("ParentID = $parentID"); + ->setSelect("MAX(\"Sort\")") + ->setFrom("\"EditableFormField\"") + ->setWhere("\"ParentID\" = $parentID"); $sort = $sqlQuery->execute()->value() + 1;