1

According to this issue, I need to drupal_weight_select_max to 1000 in my Drupal installation. It suggests several methods:

  1. Use Drush (Not an option for me as it's on shared hosting)
  2. Define it in a module (Beyond my skillset)
  3. Define it in settings.php (which seems to break my site. i.e. site doesn't load and I get WSOD)

If this can be done in phpmyadmin, can you please tell me in plain english, step-by-step how I can do this?

5

The variables are stored as serialised PHP strings so adding one to the database manually might just be a pain. You can do it quite easily though, just follow these steps:

  1. Download and install the Devel module
  2. Navigate to http://mysite.com/devel/php
  3. Put this code in the textfield:

    variable_set('drupal_weight_select_max', 1000);
    
  4. Press the 'Execute' button.

If you do want to do it directly in PHPMyAdmin you can get away with a running a single query:

INSERT INTO variable (`name`, `value`) VALUES ('drupal_weight_select_max', 'i:1000;')
  ON DUPLICATE KEY UPDATE `name` = 'drupal_weight_select_max', `value` = 'i:1000;';

and then flushing your caches.

0
  • find table variable
  • check if the variable is not there yet (column name)

    • yes : edit it
    • no : add a new record
  • new record :

    • name : drupal_weight_select_max
    • value : i:1000;
0

This comment closer to your, just open phpmyadmin, locate your database on left side, click SQL button on the top, and paste SQL code from comment:

UPDATE variable SET value = 'i:1000;' WHERE name = 'drupal_weight_select_max';

Click Run.
Then you should clear your cache, for this run clearing cache in Drupal in Performance section or do manually:
Locate Cache table, click Operations, and click on Empty the table (TRUNCATE) link.

But you should be sure that this variable exists in variable table. For this, click on Variable table, click Search button on the top, enter drupal_weight_select_max on Value for Name row and click Go.
If table exists, running SQL or updating located row will enough (clear Cache of course), otherwise click Insert and enter values that provided in comment: drupal_weight_select_max, i:1000;
For inserting, clearing cache doesn't need.

0

This doesn't really answer the question, but it is incredibly easy to add a field to the site information page to set a variable, so it can be easily edited. All you need to do is add this hook to a custom module.

function HOOK_form_system_site_information_settings_alter(&$form, &$form_state, $form_id) {

  $form['site_information']['fieldname'] = array(
    '#type' => 'textarea',
    '#title' => t('Field Title'),
    '#default_value' => variable_get('fieldname', ''),
    '#description' => t('Field description'),
    '#required' => TRUE,
  );

}

Which would arguably be the correct way of adding a sitewide variable.

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.