1

I'm inserting values using user_save(). I have used this, but it is returning the wrong values.

SELECT LAST_INSERT_ID() FROM <table name>

How can I get the ID of the last record user_save()inserted?

4

First you acquire the user object by using its return value and then you read the uid, which is also the unique value that belongs to the database row:

$user = user_save($user_obj);
$id = $user->uid;
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.