I am trying to prevent duplicate copies in a table. I am looking for duplicates where the entire row is a copy of another row. If one element of a row is a copy of somehting from another row, that is not a problem. For example, if the name is repeated in multiple fields, that is ok but if each additional field is the same as another entry, then I would like to prevent my program from adding the entry. Here is what I was going to try:
if(mysql_num_rows(mysql_query("SELECT * FROM table WHERE field1 = '$field1',field2 = '$field2', field3 = '$field3',field4 = '$field4'"))){
// send some message if entry is within table
} else {
// add unique entry to the table if field is not there
}
Will the above code search and check to see all 4 values are within each row or if all 4 values are located somewhere in each column but not necessarily in each row?