Yohanne Posted March 4, 2014 Share Posted March 4, 2014 Hi Coders, any idea how to avoid duplicate entry? ex.. numbers below that i want to insert in just one entry or single line and now i don't want to duplicate the numbers inside the comma? is this possible to trigger to avoid duplicate batch numbers. 9887455,12612511,00122211,78875545,1122223 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/286692-avoid-insert-duplicate-batch-entry/ Share on other sites More sharing options...
jairathnem Posted March 4, 2014 Share Posted March 4, 2014 (edited) <?php $string = "123,456,123"; $split = explode(',',$string); $split = array_unique($split); $string = implode(',',$split); echo $string; ?> Edited March 4, 2014 by jairathnem Quote Link to comment https://forums.phpfreaks.com/topic/286692-avoid-insert-duplicate-batch-entry/#findComment-1471419 Share on other sites More sharing options...
Yohanne Posted March 5, 2014 Author Share Posted March 5, 2014 Thanks Jairathnem, and okay.. i gut your idea and its good to be close the situation. but i only use one input and only comma are the border to identify the unique. Quote Link to comment https://forums.phpfreaks.com/topic/286692-avoid-insert-duplicate-batch-entry/#findComment-1471476 Share on other sites More sharing options...
Ch0cu3r Posted March 5, 2014 Share Posted March 5, 2014 but i only use one input and only comma are the border to identify the unique. What do you mean by one input? Jairathnem code will filter out any duplicated numbers in the comma delimited list. Which is what your original question was numbers below that i want to insert in just one entry or single line and now i don't want to duplicate the numbers inside the comma? Quote Link to comment https://forums.phpfreaks.com/topic/286692-avoid-insert-duplicate-batch-entry/#findComment-1471504 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.