PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 17, 2022

[FIXED] Laravel registration method do not give next available id to new user

 January 17, 2022     laravel, registration     No comments   

Issue

When a new user is registered through the registration form of Laravel framework, the id given to this new user is not the next id that exists in table users.

To give you an example, take a look to the next picture:

enter image description here

The id of the new registered user should be 6, and not 22.

What I assume is that for testing purposes I already have deleted some users from table users and that maybe the reason of the gap of ids.

Any ideas how to fix this?


Solution

Ids will not get reused, id column is using auto_increment by default

1 - user 1
2 - deleted
3 - deleted
4 - new user // new user will get id 4 not 2

if you manually delete users when doing your tests you should reset auto_increment

example with phpmyadmin

enter image description here

there is a AUTO_INCREMENT field you need to reset to the value you want



Answered By - Lk77
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing