All fields unique in table
Posted on 2014-01-30
Just looking for some logic behind how to approach this.
I have about 5000 url's in table - which are built by prettifying the url (remove spaces etc).
Obviously all url's need to be unique and to achieve this I append a counter to the end of the url as new products are added.
But I want to add in an approach where I can do a check on all urls and make sure there are no duplicates. This may happen because of a product name change.
So basically select all product names and urls and throw in an array - now how would you approach this?
Run through the array and do a forward lookup for the url maybe?
Newer entries should be sacrificed in favour of older urls (ID is auto)