我找不到如何让它工作的解决方案。我将 Mysql 4 升级到 Mysql 5 并将 PHP 更改为 5.2,因为我无法激活帐户和登录。这段代码有什么问题?
include_once("conn.php");
$check_num = $_GET['c'];
$exists ="SELECT * FROM registry WHERE check = '$check_num'";
$eresult = mysql_query($exists);
if (!$eresult)
{
die('<p>Error performing query: ' . mysql_error() . '</p>');
}
$row = mysql_fetch_array($eresult);
$key = $row['regkey'];
$name = $row['title'] . ' ' . $row['name'] . ' ' . $row['surname'];
$user = $row['username'];
if (mysql_num_rows($eresult) == 1)
{
$selected = mysql_query($eresult);
$sql = " UPDATE registry
SET check = 'ok'
WHERE regkey = $key";
$result = mysql_query($sql);
if (mysql_affected_rows() == 1)
{
$message = "The account $user has now been activated.";
echo "<script type=\"text/javascript\">
alert('The account $user has now been activated.');
</script>
<script>document.location.href='../index.php'</script>";
}
}
else
{
$message = "There was a problem with your check value, please try copy and pasteing the URL again. ";
}
echo $message;
?>