我正在尝试开发登录/注册系统,以便用户必须激活其帐户。我的问题是如何在数据库中检查“激活”列,如果未激活,则为0;如果他/她的帐户处于活动状态,则为1,加上我想放置一个如果它不活动以显示消息。
$sql2 = "SELECT * WHERE username2='$username2' AND activation=0";
$result2 = mysql_query($sql2);
if($result2=1){
echo"Please activate your account";
}
else{
echo " ";
}
答案 0 :(得分:0)
试试这个:
public function function_name ($username){
$this->db->select('*');
$this->db->from('table_name'); // table_name where you can find the column username and activation
$this->db->where(array('username' => $username , 'activate' => 0)); // condition use if the user is active or not
$query = $this->db->get();
return $query->return_array(); // you can also use here first_row('array')
}
我希望这会有所帮助。