divinedesigns1 Posted July 4, 2012 Share Posted July 4, 2012 how can i pervent having duplications in my database? Link to comment Share on other sites More sharing options...
westman Posted July 4, 2012 Share Posted July 4, 2012 always have an "id" filed set to auto_increment in your DBand before posting to your DB check you have not got the info in there already Link to comment Share on other sites More sharing options...
birbal Posted July 4, 2012 Share Posted July 4, 2012 http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CFYQFjAA&url=http%3A%2F%2Fwww.w3schools.com%2Fsql%2Fsql_unique.asp&ei=flP0T5jiJoeHrAeo6JXUBg&usg=AFQjCNHq2b3zgHdurTwYub2CD5JRAKGylAyou can make the column UNIQUE indexed Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 5, 2012 Author Share Posted July 5, 2012 ok, that was a bad explaination, what i meant is how i can prevent having duplication in my database with the same information in the database itselflike if i was to insert "this is annoying as ######" and then i insert again "this is annoying as ######" i want it to cancel out the second "this is annoying as ######" Link to comment Share on other sites More sharing options...
birbal Posted July 5, 2012 Share Posted July 5, 2012 did you check the link in post #3 ? It has lot of resource regarding this. you have to make it UNIQUE index so that no any duplicate entry could be inserted. If you insert same entry twice there will be an error. Link to comment Share on other sites More sharing options...
Guest So Called Posted July 5, 2012 Share Posted July 5, 2012 Why don't you do a query first to find out if it's in the database, and then only when it's not in the database do your insert? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 5, 2012 Share Posted July 5, 2012 If you're trying to stop the same person from repeatedly submitting something you can store what they've submitted in the session and each time check the data in the session to make sure they haven't already submitted it recently before adding it to the database. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 6, 2012 Author Share Posted July 6, 2012 did you check the link in post #3 ? It has lot of resource regarding this. you have to make it UNIQUE index so that no any duplicate entry could be inserted. If you insert same entry twice there will be an error.yup i haveIf you're trying to stop the same person from repeatedly submitting something you can store what they've submitted in the session and each time check the data in the session to make sure they haven't already submitted it recently before adding it to the database.ok that sound more like what im aiming for Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now