Jump to content

How to stop duplicates


Sleeper

Recommended Posts

I need a way to keep entrys into a database from being doubled. The issue is that on something like

 

%7B%7D that is the same as {} in html. So if one is entered in with the percentages and one is entered in normal, the data base thinks they are two different items even though they could be the exact same thing.

 

Now when I insert the new item into the data base the value ='s mysql_real_escape_string(htmlentities(item)) is how I do it now. This is wrong im guessing cause it could go with either of the above examples and puts them in as given.

 

So my question here is kinda two parted.

 

1) how do I get it to insert the info one way or the other but never both being allowed. So {} will always show %7B%7D when inserted or visa versa.

 

and

 

2) How do I take an existing database and sort threw it to make sure they are all the same as 1 codes the new ones in, and take out any possible dupilications due to the difference?

 

Link to comment
Share on other sites

there is a whole subtopic on this board for Regex, look through that for the regular expression stuff, it's way to big a topic to sum up in a quick post, as for the update, just run something against the database that replaces the vaules in all the fields that contain the value you want rid of.  Again, it's a little too vauge, but it depends on your table structure and field types.  I think there was someone on the MySQL forum that had a simmilar question last week.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.