I'm using md5 with random code, current datetime and customer_id to generate a hash code but after I run 200,000 records I found there is many duplicated records. How can i avoid the duplicate?
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$curr_date = date('Y-m-d H:i:s');
$hash = md5(rand(0,100000)+strtotime(date('curr_date'))+$row[0]);
echo $query = "update customers set email_hash='$hash' where customer_id='$row[0]'";
mysql_query($query) or die(mysql_error());
}