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. Quote 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 ? Quote 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 Quote 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? Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.