first I create a hash code and save it in my database:
$key = md5(uniqid(rand(), true));
$update = mysqli_query($conn, "UPDATE my_table SET md5key = MD5('$key') WHERE id = 1");
But the $key does not match the code in the database?
$key = e114e5bd4c8551d4e46a636d0c087b0e database = c00855d30f0c2c2f527b95f8be86a8b3
My field in the database has the following option:
md5key varchar(255) utf8_general_ci
Whats wrong here?
</div>
I think that's because your $key variable has an MD5 hash already, but when you make the update query, you use a MD5 function again, so the value inserted in the database will be different.
Just do this:
$key = md5(uniqid(rand(), true));
$update = mysqli_query($conn, "UPDATE my_table SET md5key = '$key' WHERE id = 1");