gpt4 book ai didi

php - [function.mysql-结果] : Unable to jump to row 0 on MySQL result index 3 in subscribe. php 第 54 行

转载 作者:行者123 更新时间:2023-11-30 00:01:52 25 4
gpt4 key购买 nike

我的新闻通讯中有错误,我不知道哪里出了问题。请帮我。现在我在做新闻通讯,第一次在我的代码中使用MySQL。

这是错误:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in subscribe.php on line 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"){
(...)

关于php - [function.mysql-结果] : Unable to jump to row 0 on MySQL result index 3 in subscribe. php 第 54 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24963489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com