Foser Posted August 10, 2007 Share Posted August 10, 2007 MySQL said: Documentation #1062 - Duplicate entry '5' for key 1 How can i make it so this entry can have a few the same? thanks Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/ Share on other sites More sharing options...
dbo Posted August 10, 2007 Share Posted August 10, 2007 Only primary keys cannot have the same id. It sounds like you're attempting to make a duplicate id which isn't allowed. Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320097 Share on other sites More sharing options...
Foser Posted August 10, 2007 Author Share Posted August 10, 2007 In structure I clicked on index: ALTER TABLE `item_post` ADD INDEX ( `id` ) and I still get the same key error...? Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320101 Share on other sites More sharing options...
dbo Posted August 10, 2007 Share Posted August 10, 2007 Make it an auto_increment and it won't give you duplicate keys. Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320103 Share on other sites More sharing options...
Foser Posted August 10, 2007 Author Share Posted August 10, 2007 I want to be able to duplicate the id's! Tha's what im trying to do, but each time I try, it says cannot duplicate id... Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320109 Share on other sites More sharing options...
dbo Posted August 10, 2007 Share Posted August 10, 2007 You need to take the index off of it then. But having duplicate id's pretty much defeats the purpose of a database. Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320114 Share on other sites More sharing options...
Foser Posted August 10, 2007 Author Share Posted August 10, 2007 its the id, of a post, which if there is a more than 1 reply would need to have more than one the same... Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320115 Share on other sites More sharing options...
dbo Posted August 10, 2007 Share Posted August 10, 2007 Nope it wouldn't. You'd have another table that lets you join records. You don't duplicate ids. Link to comment https://forums.phpfreaks.com/topic/64210-solved-duplicating-id-on-mysql/#findComment-320122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.