siwelis Posted May 4, 2010 Share Posted May 4, 2010 I need to insert a record with a specific ID, but I have to make sure it doesn't exist... How can I make sure I'm inserting a record with a new ID? It may be helpful to note that in the database the records may be duplicated- just not at this point. Link to comment https://forums.phpfreaks.com/topic/200669-insert-new-but-make-sure-not-exist/ Share on other sites More sharing options...
TeddyKiller Posted May 4, 2010 Share Posted May 4, 2010 Why don't you have the ID collum in the database as AC ? Link to comment https://forums.phpfreaks.com/topic/200669-insert-new-but-make-sure-not-exist/#findComment-1053015 Share on other sites More sharing options...
siwelis Posted May 4, 2010 Author Share Posted May 4, 2010 I'm really not sure what AC is... Unless you're talking about Auto Column (auto-increment?)... Hopefully I'm mistaken, but doesn't Auto Increment force unique ID? Either way, I tried setting it as an auto increment to try experimenting with a non-unique auto-incrementand I was given this error #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key Link to comment https://forums.phpfreaks.com/topic/200669-insert-new-but-make-sure-not-exist/#findComment-1053123 Share on other sites More sharing options...
TeddyKiller Posted May 4, 2010 Share Posted May 4, 2010 Yeah.. I meant "AI" There is another method.. How do you generate your random ID? Link to comment https://forums.phpfreaks.com/topic/200669-insert-new-but-make-sure-not-exist/#findComment-1053137 Share on other sites More sharing options...
fenway Posted May 4, 2010 Share Posted May 4, 2010 What are you trying to do? Link to comment https://forums.phpfreaks.com/topic/200669-insert-new-but-make-sure-not-exist/#findComment-1053146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.