Jump to content

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

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.