toxictoad Posted May 13, 2008 Share Posted May 13, 2008 Hi, I've created a Db using phpMyAdmin I've added the index field as the first field, with varchar(5), Index: Keyname Type Cardinality Field PRIMARY PRIMARY 1 index I thought it would need to be set to auto_increment but when I tried I got this error SQL query: ALTER TABLE `dvds` CHANGE `index` `index` VARCHAR( 5 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AUTO_INCREMENT MySQL said: #1063 - Incorrect column specifier for column 'index' So without auto_increment I added new record but the index field was blank when I was expecting it to show 1 Can anyone see what I'm doing wrong? Also what should the 'Collation' be set to or doesn't it matter? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 13, 2008 Share Posted May 13, 2008 That's because its a VARCHAR field. An auto-increment field should be an INT field. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 13, 2008 Share Posted May 13, 2008 And don't call an index "index". Quote Link to comment Share on other sites More sharing options...
toxictoad Posted May 13, 2008 Author Share Posted May 13, 2008 ok changed the field name to filmID and auto_increment is working thanks for the text fields in the db what Collation should I use? Quote Link to comment Share on other sites More sharing options...
jaymc Posted May 14, 2008 Share Posted May 14, 2008 latin_general_ci I use, pretty much standard I think, no hard and fast rule Quote Link to comment Share on other sites More sharing options...
toxictoad Posted May 14, 2008 Author Share Posted May 14, 2008 nice one jaymc Quote Link to comment 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.