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.
db_update('users')
seems to be OK, and that's the right way to do it, but you need->condition()
. See here. updates without condition should be stopped. If you need to update all rows,1 = 1
is good condition, at least it shows you was thinking what you are doing.