Welcome Guest, Not a member yet? Register   Sign In
empty variable

i want the credentials of a logged in user to display in his profile.like name and other values but the $username variable is for somereasons showing nothing at all.it is empty and displays no value at all.
my view file is

    <!DOCTYPE html>     

<!-- Without needing extra details only username and email can be obtained from session data -->
if (isset($this->session->userdata['logged_in'])) {
$username = ($this->session->userdata['logged_in']['username']);
$email = ($this->session->userdata['logged_in']['email']);
} else {
  $location = base_url();
<!--  -->
<p><?php echo $username; ?></p>
<p><?php echo $data[0]['username']; ?></p>
<!-- Since now data is in array form because of $query->result_array $data[0]['username'] is suffice -->

<img src="images/home-user-icon.png" style="width:150px"; height:150px; float:left; border-radius:50% ; margin-right:25px;">
<?php echo form_open_multipart('main/save');?>
<table class="table">

<td><?php echo form_upload('pic');?></td>
<td><?php echo form_submit('submit','save','class="btn btn-primary"');?></td>
<table class="friends">

and my controller part is
"public function index(){
        //plz  enter the code here to fetch the data of logged in user so that i can use the logged in user's information in the view main.php.
    $username = $this->session->userdata['logged_in']['username'];
    $result['data'] = $this->Login_Database->read_user_information($username);
    // Change has been made in Login_Database, Line108. $query->result is changed to $query->result_array


Theme © iAndrew 2016 - Forum software by © MyBB