<?php

namespace SpellingDictionary;

class Words {
	static function addWord( $formData ) {
		// $user = $this->getUser();
		global $wgSpellingDictionaryDatabase;
		$dbw = wfGetDB( DB_MASTER, array(), $wgSpellingDictionaryDatabase );

		$user = "ABC";

		$values = array(
			'sd_word' => $formData['word'],
			'sd_language' => $formData['language'],
			'sd_user' => $user,
			'sd_timestamp' => $dbw->timestamp(),
		);

		$dbw->insert( 'spell_dict_word_list',
			$values,
			__METHOD__ );
			return true;
		// return 'Try again';
	}
}

<?php

namespace SpellingDictionary;

class Words {
	public function addWord() {
		$dbw = Database::getConnection( DB_MASTER );
		}

}
--- 
+++ 
@@ -3,8 +3,24 @@
 namespace SpellingDictionary;
 
 class Words {
-	public function addWord() {
-		$dbw = Database::getConnection( DB_MASTER );
-		}
+	static function addWord( $formData ) {
+		// $user = $this->getUser();
+		global $wgSpellingDictionaryDatabase;
+		$dbw = wfGetDB( DB_MASTER, array(), $wgSpellingDictionaryDatabase );
 
+		$user = "ABC";
+
+		$values = array(
+			'sd_word' => $formData['word'],
+			'sd_language' => $formData['language'],
+			'sd_user' => $user,
+			'sd_timestamp' => $dbw->timestamp(),
+		);
+
+		$dbw->insert( 'spell_dict_word_list',
+			$values,
+			__METHOD__ );
+			return true;
+		// return 'Try again';
+	}
 }
Insert the word submitted into the table

-Presently used a dummy variable as user, to be changed to the current
session user
