Storing data to database and user registration

Look like you need used hook user_register

it’s return to you user id, after that you can save it in DB.

error code: 523