Skip to main content
3 of 5
deleted 75 characters in body
Ram
  • 1.3k
  • 15
  • 37

db_update Query Issue

I am using ubercart guest checkout module. I am able to submit the order as guest etc works fine.

After Reviewing the order and submitting it throws me this error

Recoverable fatal error: Argument 2 passed to db_query() must be an array,
string given, called in
/var/www/html/dev.demo.net/sites/all/modules/ubercart_guest_checkout/uc_guest_checkout.module
on line 263 and defined in db_query() (line 2342 of
/var/www/html/dev.demo.net/includes/database/database.inc).

This is the query which is causing that issue

db_query('UPDATE {users} SET name = "%s", mail = "%s" WHERE uid = %d', $name, $mail, $account->uid);

I tried to change this query like this

db_update('users')
->fields(array(
    'name' => $name,
    'mail' => $mail
))
->condition('uid',$account->uid,'=')       
->execute();

still no luck, it throws me same above specified error.

How can i resolve the query of above one in order to avoid the error. Any suggestions w.r.t query will be nice.Thanks in advance.

Ram
  • 1.3k
  • 15
  • 37