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”);
}
}

3 thoughts on “script php mysql untuk mencegah duplikasi data

  1. Agustinus says:

    saya mau tanya gan… bagaimana perintahnya jika duplikasi data yang diinginkan itu bukan hanya 1field tapi lebih dari 2 ??? tq

Ditunggu komennya ...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s