Prev |  | Next

#### 2.3.7.3. Saving module settings to the database

Another tool is the function `phorum_db_update_settings()` that can be used for storing settings in the database. To store settings using this function, you can use code like this:

Example 2.10. Storing settings for a module in the database

      // It is possible to store either scalars or arrays in a settings field.
      // Phorum will automatically take care of correct handling.
      $foo_settings = array();
      $foo_settings["foodata"] = "Some setting data";
      $foo_settings["bardata"] = "Some more setting data";

      // Store the data in the database.
      phorum_db_update_settings(array("mod_foo" => $foo_settings));

      // In the next request, the settings data can be found in
      // the variable $PHORUM['mod_foot'], for example:
      print $PHORUM['mod_foo']['foodata'];

Prev | Up | Next
| Home |