Lethal323 Posted June 24, 2008 Share Posted June 24, 2008 Im wondering how to make it so when a user registers with my website it will automatically make there user_ref_id go up by one... So If I registered I would be 0 then when jimmy bob registered he would be 1 and so on a so forth... I know a way to do it but I know there is an easier way. Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/ Share on other sites More sharing options...
mongoose00318 Posted June 24, 2008 Share Posted June 24, 2008 in the database just set it to auto_increment..and the db will automatically do it Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573666 Share on other sites More sharing options...
Lethal323 Posted June 24, 2008 Author Share Posted June 24, 2008 Incorrect table definition; there can be only one auto column and it must be defined as a key huh? I dont get that one. Im good at the coding part but not the database part. Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573671 Share on other sites More sharing options...
trq Posted June 24, 2008 Share Posted June 24, 2008 It would help us if you showd us the query that produced the error. Seems your trying to impliment two auto_incrementing fields. Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573678 Share on other sites More sharing options...
Lethal323 Posted June 24, 2008 Author Share Posted June 24, 2008 I have no auto increment fields. Im just trying to add this one. Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573679 Share on other sites More sharing options...
mongoose00318 Posted June 24, 2008 Share Posted June 24, 2008 You have to define a field as a primary key. Did you do that? Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573680 Share on other sites More sharing options...
Lethal323 Posted June 24, 2008 Author Share Posted June 24, 2008 Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573682 Share on other sites More sharing options...
kenrbnsn Posted June 25, 2008 Share Posted June 25, 2008 Just make the user_ref_id to be autoincrement. Ken Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573700 Share on other sites More sharing options...
bluejay002 Posted June 25, 2008 Share Posted June 25, 2008 set user_id to auto_increment and/or make it a primary key. Quote Link to comment https://forums.phpfreaks.com/topic/111750-increment/#findComment-573706 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.