php/mysql帐户激活 [英] php/mysql account activation

查看:67
本文介绍了php/mysql帐户激活的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的新网站中的所有内容都可以正常工作,只是我无法使这段代码正常工作

Everything in my new website is working just fine, except that I can't get this piece of code to work:

$query = mysql_query("SELECT * FROM members WHERE useremail = '$useremail'");
$row = mysql_fetch_assoc($query);
$activation = $row['activation'];
if ($activation == '0') {
    die('Your account is not yet active. Please check your email!');
    exit();
}

在数据库中,类型为enum('0', '1'),字段名称为activation.

In the database, the type is enum('0', '1') and the field name is activation.

这是我收到的错误消息:

Here is the error message I am getting:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result

有人可以给我一个提示吗?

Could someone please give me a hint?

谢谢.

推荐答案

我的新网站中的所有内容都正常运行

Everything in my new website is working just fine

...直到出现问题.

...until something goes wrong.

您必须学习如何处理错误.

至少以此方式全部运行您的查询.

run all your queries at least this way.

$query  = "SELECT * FROM members WHERE useremail = '$useremail'"
$result = mysql_query() or trigger_error(mysql_error()." ".$query);

总是会收到任何错误通知,并且是原因

and you always be notified of any error and it's reason

或使用 mysql_error()函数实现任何其他错误通知方式,这是世界上唯一可以告诉您实际问题出在哪里的函数.

or implement any other way of error notifications, employing mysql_error() function which is the only thing in the world that can tell you where the actual problem is.

这篇关于php/mysql帐户激活的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆