script php mysql untuk mencegah duplikasi data


For note

/Check for duplicate data
if($data1 AND $data2!= ”) {
$qry = “SELECT * FROM tabel WHERE data1=’$data1′ AND data2=’$data2′”;
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errmsg_arr[] = ‘any duplicate data’;
$errflag = true;
}
@mysql_free_result($result);
}
else {
die(“db failed”);
}
}

Advertisement