Ian Ian - 5 months ago 16
PHP Question

insert_id not getting the current id

I have been reading the other quotes regarding this and haven't found an answer. I'm trying to return the record id with


$user = $db->query("
INSERT INTO users(user_name,user_email,user_password,user_salt,
VALUES ('".$userName."',
#Add the user
$newID = $user->insert_id;

If any one has any idea that would be great.


Solution in your case will be using $newID = $db->insert_id; instead of $newID = $user->insert_id;.