dudejma Posted June 21, 2011 Share Posted June 21, 2011 I'm trying to make it create user logins. I'm wanting it to be where once the user registers, it automatically creates a login ID, but I'm wanting it to start at a certain number. How would I do this? With auto increment or with something in the code. I'm fairly new to PHP and MySQL so excuse my ignorance. Thanks. Link to comment https://forums.phpfreaks.com/topic/239943-auto-increment/ Share on other sites More sharing options...
fugix Posted June 21, 2011 Share Posted June 21, 2011 If you are storing your user data into a database, which it sounds like you are, you can create a field as an int, primary key and auto-increment, and set that as your user id which will be unique Link to comment https://forums.phpfreaks.com/topic/239943-auto-increment/#findComment-1232554 Share on other sites More sharing options...
requinix Posted June 21, 2011 Share Posted June 21, 2011 In your CREATE TABLE you can set the AUTO_INCREMENT value: CREATE TABLE table (...) AUTO_INCREMENT = 1234; If it exists then you can use ALTER TABLE: ALTER TABLE table AUTO_INCREMENT = 1234; Link to comment https://forums.phpfreaks.com/topic/239943-auto-increment/#findComment-1232555 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.