title: how to check duplicate records in mysql database
body: <pre><code>$queryb = "SELECT product, imei, country, warranty, config from PRODUCT WHERE product_slno = '$mnserialno' ";
  $resultb = mysql_query($queryb, $gndbconn) ;
  if(mysql_num_rows($resultb) &gt; 0)
  {
      $queryc = "UPDATE PRODUCT SET product='$desc', product_slno='$mnserialno',imei='$imei',country='$country',warranty='$warranty',config='$config' WHERE product_slno = '.$mnserialno.' ";
       $resutc = mysql_query($queryc, $gndbconn) ;
   }
  else{
      $querya  = "INSERT INTO PRODUCT SET product='$desc', product_slno='$mnserialno',imei='$imei',country='$country',warranty='$warranty',config='$config'";
      $resulta = mysql_query($querya, $gndbconn) ; 
   }  
  </code></pre>
  
  <p>I want to check the serial number if that serial number already exist in database so records get update, otherwise it get insert into the database.
  but the code inserting the records only, no updation, what is the fault i am not getting,
  how to prevent the duplicate entry?</p>