I have a user input form which creates any number of records to insert into a database - it could be 1 record it could be 23 it could be 45 etc.etc.
I have got this working OK - but on user trials I am finding the user is inputing the same records more than once in error , but sometimes one of the fields might contain slightly different information and I only want to take the first input information as the record to go in the database.
So I want to add a condition/clause so that if the records already exists (if record with the same primary information in fields Date Ref, MRef, SRef, CRef, CoRef is already in the database) don't add it again with the new information for B and C and User. - Any Ideas?
At the moment I am using
$query = "REPLACE INTO tblResults (DateRef,MRef,SRef,CRef,CoRef,B,C,LoadedBy)
VALUES ('$DateRef','$MId','$SRef','$CRef','$CoRef','$B','$C','$UserId')";
$result = mysql_query($query)
or die(mysql_error());