-2

How to get variable from help of variable_get function, function has saved value on any db table or some where else?

1

To get the value use:

$valueVar = variable_get('myvar');

It is saved on a generic database table called [prefix]_variable, if you are not using prefix, the name of the table is variable. Look at: https://www.drupal.org/forum/support/module-development-and-code-questions/2009-05-14/help-which-table-is-the-variable

0

You can use variable_set() to set the value and that will store it in the database. e.g.

variable_set('myvar',123);

Then to retreive it:

$myvar = variable_get('myvar');

You could create a page with a form to allow CMS users to change the values of your variables. See this for examples: https://api.drupal.org/api/drupal/modules%21system%21system.module/function/system_settings_form/7.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.