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).

1 Answer 1

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();
1
  • Oh my god!! I am new in drupal and I am sorry about that... Thank you!
    – Karmen
    Apr 15, 2015 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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