PHP MySQL脚本错误?

时间:2010-09-25 03:52:12

标签: php mysql

我有以下PHP代码,似乎无法正常工作。我一遍又一遍地看错了,但找不到它们。

<?php
$actkey = rand() . "\n";
$con = mysql_connect("HOST", "USER", "PASS");
if (!$con)
  {
  die('Unable to connect:  ' . mysql_error());
  }

mysql_select_db("TABLE", $con);

mysql_query("UPDATE members SET Activation = $actkey WHERE username = 'admin'");
mysql_close($con)

$con2 = mysql_connect("HOST" , "USER" , "PASS");
if (!$con2)
  {
  die('Unable to connect:  ' . mysql_error());
  }
mysql_select_db("a1719745_insaneb", $con2);
$query = mysql_query("INSERT INTO Activation (keycode, valid) VALUES ($actkey, 'yes')");
if(!mysql_query($query, $con2)) {
  die('Error:  ' . mysql_error());
}
mysql_close($con2);
echo "Complete";
?>

有什么想法吗?

1 个答案:

答案 0 :(得分:4)

mysql_close($con)之后缺少分号。