Error Using user.save

Using the user.save method I receive the following error:

user warning: Duplicate entry '' for key 2 query: INSERT INTO users (created, access) VALUES (1254426886, 1254426886) in htdocs/modules/user/user.module on line 327.

I'm using Drupal 6.14 and the lastest version of AMFPHP and the Services module.

Nothing I've tried seems to work, so yny help getting past this problem would appreciated.

Groups:
Login to post comments

Issue On Uid

alagirivimal - Mon, 2009-11-09 07:42

Hi

 This is error mean entered user id not in database table.

 please enter uid = 1 and check.

 otherwise have issue reply i will help to you

new user register modules:
-========================

// user.add
array(
  '#method'           => 'user.add',
  '#callback'         => 'user_service_add',
  '#file'             => array('file' => 'inc', 'module' => 'user_service'),
  '#args'             => array(
    array(
      '#name'           => 'name',
      '#type'           => 'string',
      '#description'    => t('User Name.'),
    ),
    array(
      '#name'           => 'pass',
      '#type'           => 'string',
      '#description'    => t('User Password.'),
    ),
    array(
      '#name'           => 'mail',
      '#type'           => 'string',
      '#description'    => t('User Email.'),
    ),
 ),
  '#return'           => 'struct',
  '#help'             => t('Added user details.')
),

new user INC
==============

function user_service_add($name,$pass,$mail) {

$account_add = user_save($account,array('name' => $name, 'pass' => $pass, 'mail' => $mail, 'status' =>'1'));

if (!$account_add) {
return services_error(t('Error on saving the user.'));
}

return $account_add->uid;
}


Thanks for your reply, but

polliwog - Mon, 2009-11-09 14:11

Thanks for your reply, but we've already decided to take another route with this project in order to bypass this problem


Hope you can share, we have

jomesili - Mon, 2009-11-09 16:30

Hope you can share, we have been having this issue for some time, i haven't gotten past it yet


Unfortunately our solution

polliwog - Mon, 2009-11-09 18:16

Unfortunately our solution did not fix the user.save problem. We gave up trying to make it work and instead hired someone who created new services specific to our project. These new services handle storing and retrieving data that we originally planned on storing in custom fields in a user's profile.