Jump to content

Preventing duplicates during entry


mysty

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/81225-preventing-duplicates-during-entry/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.