I am trying to execute a query with 5 parameters, but it don't add more than 4 parameters. Is there a limit? I tried putting them inside an array, but the problem continues:


  drupal_set_message(sprintf("INSERT INTO {working_users}
            (uid, nid, wu_type, initial_date, role) VALUES (%d, %d, '%s', '%s')",
            array ($form_values['user'],
                      $form_values['working_unit'],
                      $form_values['working_user_type'],
                      date('Y-m-d'),
                      serialize (array('role' => $form_values['wu_role'], 
                                               'actions' => $form_values['wu_actions']))
          )));
  db_query("INSERT INTO {working_users}
            (uid, nid, wu_type, initial_date, role) VALUES (%d, %d, '%s', '%s')",
            array($form_values['user'],
                      $form_values['working_unit'],
                      $form_values['working_user_type'],
                      date('Y-m-d'),
                      serialize(array('role' => $form_values['wu_role'], 
                                              'actions' => $form_values['wu_actions']))
             ));

Comments

Island Usurper’s picture

There's only 4 replacement tokens. The function doesn't have a place to put the last parameter, so it just ignores it. Add another '%s' to the VALUES list.

-----
Übercart -- One cart to rule them all.

enboig’s picture

Thank you, I was pretty sure I had checked that, but it seems I didn't.

La vida és una taronja, què esperes per exprimir-la?