简体   繁体   中英

How to check logged in user is male or female mysql and codeigniter

controller code want to check my logged in user is male or female for matrimony

  public function profile() {
        $this->load->view('header');
        if ($this->session->userdata('logged_in')) {
            //get session Id 
            $uname = $this->session->userdata();

            //get Data from db
            $row = $this->brid_groom_fetch->get_program_specific_gender();

            if ($row = $uname) {
                //session id and db id matched 
                $session_id = $this->session->userdata();

                //here i want to check login user is male or female
            }
        }
    }

I didn't get your logic to ask this question, its obvious that you will get gender specific information from DB and set all user data to your session, and display get your desired info by getting from session.

Set to Session:

$_SESSION["gender"] = "male";
$_SESSION["age"] = "28";

And Get from Session:

<?php
   echo "Gender is " .$_SESSION["gender"];
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM