我想讓for循環返回單個值(TRUE/FALSE)。但代碼返回多個值。像TRUETRUETRUE一樣。我瞭解代碼,但沒有任何想法去做。PHP用於循環返回單個值
public function user_activation_check(){
for($i=1;$i<5;$i++){
$query = $this->db->query("SELECT group_info.member".$i." FROM `group_info` INNER JOIN `user_student` ON group_info.member$i=user_student.email WHERE user_student.email=group_info.member$i");
if($query->num_rows()==1){
//return TRUE;
echo"true";
}else {
//return FALSE;
echo"false";
}
}
}
請幫忙。
UPDATE:
public function member_activation(){
if($this->model_users->user_activation_check()){
$this->load->view('v_confirm_group');
}else echo "Some members didn't activate their account.";
}
我呃,我看不出它如何能返回多個值。根本不對。這是你的整個代碼嗎? –
函數每次調用時只返回一個值... –
那麼爲什麼你使用循環? – vlcekmi3