PHP-Auth icon indicating copy to clipboard operation
PHP-Auth copied to clipboard

User ID Increment Broken?

Open 03kkim opened this issue 5 years ago • 3 comments

Whenever I $auth->register() a new user, I expect it to add a new user with an id 1 value higher than the last registered user, but for some reason, it doesn't seem to do that. The pattern from 1-10 is fine, it's just 1, 2, 3, etc., but after it hits 10, it starts going 11, 21, 31, etc. until it hits what is supposed to be "20," where it then becomes 101, 111, 121, etc. Is this a bug or is it working as intended? Thanks in advance!

03kkim avatar Sep 17 '20 17:09 03kkim

Thanks!

This is probably specific to, and caused by, your database engine. What database system are you using? MySQL or MariaDB, PostgreSQL, SQLite, something else? That sequence can usually be configured there.

This library uses AUTO_INCREMENT (for MySQL and MariaDB), SERIAL (for PostgreSQL) and AUTOINCREMENT (for SQLite) in its database tables, as you can see in the Database folder.

ocram avatar Sep 17 '20 21:09 ocram

I'm using MySQL, and I found the file. What should I do to troubleshoot the issue?

03kkim avatar Sep 18 '20 01:09 03kkim

Please try searching for “increment” on the following page:

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html

Look up these configuration values and see if they need to be changed.

If you’re using InnoDB as your engine, the following might also help:

https://dev.mysql.com/doc/refman/8.0/en/innodb-auto-increment-handling.html

And, finally, if you’re using replication, the following two pages might be of help:

https://dev.mysql.com/doc/refman/8.0/en/replication-features-auto-increment.html

https://dev.mysql.com/doc/refman/8.0/en/replication-options-master.html

ocram avatar Sep 18 '20 14:09 ocram