Check for duplicates before inserting

You want to do the following:

$dupesql = "SELECT * FROM table where (name="$name" AND description = '$description' AND manufacturer="$manufacturer" AND city ='$city' AND price="$price" AND enddate="$end_date")";

$duperaw = mysql_query($dupesql);

if (mysql_num_rows($duperaw) > 0) {
  //your code ...
}

See Here for more information.

Leave a Comment