pokeronald Posted July 6, 2003 Share Posted July 6, 2003 hi, i want like when sumbody signs up and the id number increase automatically. in the db, which type do i use? when i tried some of the options, there was an error : Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/ Share on other sites More sharing options...
shivabharat Posted July 8, 2003 Share Posted July 8, 2003 An example Hope this helps CREATE TABLE `emp` (`Id` bigint(20) NOT NULL auto_increment, `name` varchar(20) default NULL,`age` int(10) default NULL,`details` varchar(200) default NULL,PRIMARY KEY (`Id`) ); Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2242 Share on other sites More sharing options...
pokeronald Posted July 8, 2003 Author Share Posted July 8, 2003 error message: \"Incorrect table definition; There can only be one auto column and it must be defined as a key\" what does that mean? Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2244 Share on other sites More sharing options...
gizmola Posted July 8, 2003 Share Posted July 8, 2003 error message: \\\"Incorrect table definition; There can only be one auto column and it must be defined as a key\\\" what does that mean? It means that there can only be one auto_increment column per table, and that column must be a key for the table, usually the primary key. Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2247 Share on other sites More sharing options...
bAnthony Posted July 8, 2003 Share Posted July 8, 2003 are you using phpMyAdmin or just writing scripts? Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2252 Share on other sites More sharing options...
pokeronald Posted July 8, 2003 Author Share Posted July 8, 2003 but there IS no auto_increment else in my table... i\'m using phpadmin then how do u define it as a key? Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2263 Share on other sites More sharing options...
gizmola Posted July 9, 2003 Share Posted July 9, 2003 If the table already exists, you would need to use alter table. Quote Link to comment https://forums.phpfreaks.com/topic/677-auto-increment/#findComment-2266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.