I am getting this error: Argument 2 passed to db_query() must be an array, string given. In db_query in below function.
function uc_guest_checkout_uc_checkout_complete($order, $account) {
if (!empty($_SESSION['uc_guest_checkout']) && !user_is_logged_in()) {
switch ($order->data['complete_sale']) {
case 'new_user':
// For guest checkout, we replace the ubercart generated username and email
// for a new user with one that is more anonymous.
$name = uniqid('anon-', TRUE);
$mail = $name . '.' . uc_store_email();
db_query('UPDATE {users} SET name = "%s", mail = "%s" WHERE uid = %d', $name, $mail, $account->uid);
break;
case 'logged_in':
// If the order is marked logged in but anonymous, this means that
// we must have set the uid to the default account, but still treat
// this as a new user.
$order->data['complete_sale'] = 'new_user';
break;
}
}
_uc_guest_checkout_end();
}
I tried this queries but none were creating account with valid names and emails as per db_query which is throwing error but successfully creating user accounts.where as these below queries creating names with random names.
db_update('users')
->fields(array(
'name' => $name,
'mail' => $mail
))
->condition('uid', $account->uid)
->execute();
db_query('UPDATE {users} SET name = :name, mail = :mail WHERE uid = :uid',
array(':name' => $name, ':mail' => $mail, ':uid' => $account->uid));
How do I resolve this?