I have no idea how this happens. I have tried the SQL straight through phpMyAdmin and it works perfectly, but yet when I try it through the script, it deletes the row instead of just updating it.
It is set into a function below
function Confirm(){
global $HTTP_SERVER_VARS, $user_info;
$id = $_GET["id"];
$md5 = $_GET["secret"];
if (!$id)
httperr();
$res = mysql_query("SELECT passhash, editsecret, status FROM users WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row)
httperr();
if ($row["status"] != "pending") {
header("Refresh: 0; url=/ok?type=confirmed");
exit();
}
$sec = hash_pad($row["editsecret"]);
if ($md5 != md5($sec))
httperr();
$updateSQL = "UPDATE `users` SET `status` = 'confirmed' WHERE `id` =".$id." LIMIT 1 ";
mysql_query($updateSQL) or die(mysql_error());
logincookie($id, $row["passhash"]);
header("Location: /ok?type=confirm");
}
I have tried the $updateSQL and it returns no errors, but the mysql_query is deleting it.
Any thoughts on why this would be doing this ???