function variable_get

7.x variable_get($name, $default_value = "")
6.x variable_get($name, $default_value = "")
4.x variable_get($name, $default_value = "")
5.x variable_get($name, $default_value = "")

Get a variable from the database. We will first look in our GLOBALS array, to see that it hasn't already been retrieved this page load.


string $name:

mixed $default_value:

Return value


116 calls to variable_get()
admin_add_degree_form in modules/admin/
This form lets the user add a degree to the database.
admin_add_degree_form_submit in modules/admin/
Submit handler for the add_degree_form.
admin_apply_draft_changes_form_submit in modules/admin/admin.module
Handles the actual moving of draft courses into production.
admin_apply_draft_changes_form_validate in modules/admin/admin.module
Before we apply changes, make sure the password is correct.
admin_cron in modules/admin/admin.module

... See full list


includes/, line 882
This file contains mostly db shortcuts.


function variable_get($name, $default_value = "") {

  $val = null;
  // First, check in our GLOBALS array, like a cache...
  if (isset($GLOBALS ["fp_system_settings"][$name])) {
    $val = $GLOBALS ["fp_system_settings"][$name];
  else {
    // Not found-- look in the database for it.
    $res = db_query("SELECT value FROM variables
                           WHERE name = ? ", array($name));
    $cur = db_fetch_array($res);
    @$val = unserialize($cur ["value"]);

    // Save back to our cache...
    $GLOBALS ["fp_system_settings"][$name] = $val;


  if (!$val) {
    $val = $default_value;

  // We must have this down here again, just in case what got stored in the GLOBALS
  // array was this placeholder.  This can happen, because the settings file doesn't do
  // this check when assembling this variable on page load.  It's something that needs
  // to be fixed.
    $val = FALSE;

  if ($val === "NULL_PLACEHOLDER") {
    $val = NULL;

  return $val;