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? Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/ 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. Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/#findComment-540337 Share on other sites More sharing options...
fenway Posted May 13, 2008 Share Posted May 13, 2008 And don't call an index "index". Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/#findComment-540352 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? Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/#findComment-540393 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 Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/#findComment-540837 Share on other sites More sharing options...
toxictoad Posted May 14, 2008 Author Share Posted May 14, 2008 nice one jaymc Link to comment https://forums.phpfreaks.com/topic/105482-solved-index-field/#findComment-541095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.