1
$number_to_keep = db_select('variable', 'va')
    ->fields('va.value')
    ->condition('va.name', 'dblog_row_limit', '=')
    ->execute();

And it gets me out that errors:

Notice: Undefined index: table in SelectQuery->preExecute() (line 1245 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->compile() (line 1079 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->compiled() (line 1097 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: arguments in SelectQuery->arguments() (line 1024 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->arguments() (line 1028 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->compiled() (line 1097 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->__toString() (line 1531 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: table in SelectQuery->__toString() (line 1538 of /var/www/html/drupal/includes/database/select.inc). Notice: Undefined index: alias in SelectQuery->__toString() (line 1543 of /var/www/html/drupal/includes/database/select.inc).

2

The signature for SelectQuery::fields() is:

public SelectQuery::fields($table_alias, array $fields = array())

So you need:

$number_to_keep = db_select('variable', 'va')
  ->fields('va', array('value'))
  ->condition('va.name', 'dblog_row_limit', '=')
  ->execute();
  • Oh my god!! I am new in drupal and I am sorry about that... Thank you! – Karmen Apr 15 '15 at 8:39

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.