如果else语句不能用于会话和数据

时间:2019-05-22 07:24:16

标签: php codeigniter if-statement session continuous-integration

我有if else语句,带有会话和数据的语句是从数据库获取的,并且想要显示字符串,但是我卡住了该字符串,不会显示。 任何帮助将不胜感激,谢谢。

注意:我正在使用Codeigniter

这是视图

<?php
foreach($casis as $casiss):
    $sdhupload = $casiss['sdhupload']; // Y/T
    $session = $this->session->userdata("user_upload"); // T

    if($session == 'T' && $sdhupload == 'T'):
        echo '1';
        foreach($casis as $casiss):  
            echo $casiss['sdhupload']; 
        endforeach;
    elseif($session == 'T' || $sdhupload == 'Y'):
        echo '2';
        foreach($casis as $casiss):  
            echo $casiss['sdhupload']; 
        endforeach;
    elseif($session == 'T'):
        echo '3';
    else:
        echo '4';
    endif;

endforeach;
?>

这是模特

function datacasis(){
        $id = $this->session->userdata('user_id');

        $this->db->where('id_akuncasis',$id);
        $datacasis= $this->db->get('tb_casis');

        return $datacasis->result_array();    
    }

控制器

public function index()
{
$data["casis"] = $this->m_datacasis->datacasis();

        $this->load->view('casis/v_dashboardcasis', $data);    
}

0 个答案:

没有答案