mysty Posted December 11, 2007 Share Posted December 11, 2007 Now that I have the dupe issue working well (see my other thread entitled "Help in displaying duplicates in database") I have discovered that I have over 3,200 duplicates. Some with 2 and some with 3 or more. What I would like to do now is to prevent the dupes from being entered. So, is there a way (or what is the best way) to get a popup or error message that there is already a database row with the same firsname AND lastname entry? Quote Link to comment https://forums.phpfreaks.com/topic/81225-preventing-duplicates-during-entry/ Share on other sites More sharing options...
paul2463 Posted December 11, 2007 Share Posted December 11, 2007 yes, run a query on the database that checks for the said rows <?php $query = "SELECT idrow FROM table WHERE info is something"; $result = mysql_query($query); $num = mysq_num_rows($result); //will be either 0 if its not there or more than zero if it is if($num > 0) { //checks for an entry ?> <strong>Data Already exists </strong> <?php } ?> hope that makes sense Quote Link to comment https://forums.phpfreaks.com/topic/81225-preventing-duplicates-during-entry/#findComment-412206 Share on other sites More sharing options...
fenway Posted December 12, 2007 Share Posted December 12, 2007 Depends how you want to handle this... an unique index prevents the duplicate... but there are many different unique humans with the same name...?!?! Quote Link to comment https://forums.phpfreaks.com/topic/81225-preventing-duplicates-during-entry/#findComment-412950 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.