我的时事通讯出错了,我不知道哪里出错了。请帮帮我。现在我在做通讯,我第一次在我的代码中使用MySQL。
错误如下:
下面是我的代码:警告:mysql_result() [function。
MySQL .php的第54行
if($mail == NULL){
}
else{
$token = sha1(time());
$result1 = @mysql_query("INSERT INTO newsletter (Address,Token) VALUES ("".$mail."", "".$token."") ");
if ($result1) {
sendmail($mail);
}
else{ /*This else */
$result2 = mysql_query("SELECT Confirmed FROM newsletter where Address = "".$mail."" ");
$confirm = mysql_result($result2,0);
if($confirm == "y"){
}
else if($confirm == "n"){
}
}
}
?>
我做错了什么?
你可以试试:
(...)
else{ /*This else */
$result2 = mysql_query("SELECT Confirmed FROM newsletter where Address = "".$mail."" ");
if($row = mysql_fetch_array($result2)) {
$confirm = $row["Confirmed"];
}
else {
$confirm = "n"; // Returned 0 rows
}
$confirm = mysql_result($result2,0);
if($confirm == "y"){
}
else if($confirm == "n"){
(...)