function variable_set

7.x variable_set($name, $value)
6.x variable_set($name, $value)
4.x variable_set($name, $value)
5.x variable_set($name, $value)

Set a variable value, so we can retrieve it later on.

This will write to our variables database table, as well as store in a cache array for quick look-up later.


unknown_type $name:

unknown_type $value:

24 calls to variable_set()
admin_apply_draft_changes_form_submit in modules/admin/admin.module
Handles the actual moving of draft courses into production.
admin_cron in modules/admin/admin.module
advise_cron in modules/advise/advise.module
comments_cron in modules/comments/comments.module
content_cron in modules/content/content.module

... See full list


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


function variable_set($name, $value) {

  // Save back to our "cache" GLOBALS array:
  $GLOBALS ["fp_system_settings"][$name] = $value;

  // Boolean FALSE presents unusual problems when we try to tell if it got unserialized correctly.
  // We will convert it to a placeholder so we can positively store it.   
  if ($value === FALSE) {
  // Same for NULL value
  if ($value === NULL) {
    $value = "NULL_PLACEHOLDER";

  db_query("DELETE FROM variables WHERE name = ?", $name);

  db_query("INSERT INTO variables (name, value)
              VALUES (?, ?) ", $name, serialize($value));