0

I have all this error but when i am running cron without cron ultimate all run perfect but with cron ultimate i got that errors... Could anyone help i really need help here:

    exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error
    or access violation: 1064 You have an error in your SQL syntax; check
    the manual that corresponds to your MySQL server version for the right
    syntax to use near '))' at line 1' in
    /var/www/html/drupal7.36/includes/database/database.inc:2171
    Stack trace:
    #0 /var/www/html/drupal7.36/includes/database/database.inc(2171): PDOStatement->execute(Array)
    #1 /var/www/html/drupal7.36/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
    #2 /var/www/html/drupal7.36/includes/database/query.inc(858): DatabaseConnection->query('DELETE FROM {er...', Array, Array)
    #3 /var/www/html/drupal7.36/sites/all/modules/bla/includes/bla.functions.inc(245): DeleteQuery->execute()
    #4 /var/www/html/drupal7.36/sites/all/modules/bla/bla.module(56): bla_clean()
    #5 [internal function]:bla_cron()
    #6 /var/www/html/drupal7.36/sites/all/modules/ultimate_cron/ultimate_cron.module(941): call_user_func('bla_...')
    #7 [internal function]: _ultimate_cron_run_hook('bla_...', Array)
    #8 /var/www/html/drupal7.36/sites/all/modules/background_process/background_process.module(574): call_user_func_array('_ultimate_cron_...', Array)
    #9 /var/www/html/drupal7.36/sites/all/modules/background_process/background_proces
    s.module(503): background_process_service_execute('uc:error_log_ji...', false)
    #10 [internal function]: background_process_service_start('uc%3Aerror_log_...')
    #11 /var/www/html/drupal7.36/includes/menu.inc(519): call_user_func_array('background_proc...', Array)
    #12 /var/www/html/drupal7.36/index.php(21): menu_execute_active_handler()
    #13 {main}

function blabla_clean() {
  $number = variable_get('blabla_number_select');
  // Keeps values equal to the number that user had selected.
  $query = db_select('blabla', 'j')
    ->fields('j')
    ->range(0, $number)
    ->orderBy('j.timestamp', 'DESC');
  $ids = $query->execute()->fetchCol();

  // Deletes all the other values.
  db_delete('blabla')
    ->condition('wid', $ids, 'NOT IN')
    ->execute();
}
4

The issue isn't Ultimate cron, per se. It's your custom bla module; it's running some function called bla_clean() that's building a Delete SQL query with broken syntax. When executed, it's producing the error.

You're using the NOT IN operator incorrectly. Here's a post that demonstrates a NOT IN within a query.

0

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.