Welcome Guest, Not a member yet? Register   Sign In
Couple Questions
#10

[eluser]mfroseth[/eluser]
[quote author="mfroseth" date="1337868534"][quote author="Samus" date="1337866174"][quote author="mfroseth" date="1337864716"]Anybody? [/quote]
store it in a session and then retrieve it?[/quote]
This is my code, however I can't get it to display for the life of me:

Code:
function displayUsername ()

  {
  
  $user_id = $this->session->userdata('user_id');
  
  $query = $this->db->get_where('users', array('id' => '$user_id'));
  
  foreach ($query->result() as $row)
  {
   echo $row->username;
  }
    
      
  }
[/quote]

Gah, stupid typos. Had $user_id in single quotes for my $query.


Messages In This Thread
Couple Questions - by El Forum - 05-23-2012, 12:55 PM
Couple Questions - by El Forum - 05-23-2012, 01:05 PM
Couple Questions - by El Forum - 05-23-2012, 01:14 PM
Couple Questions - by El Forum - 05-23-2012, 01:35 PM
Couple Questions - by El Forum - 05-23-2012, 01:40 PM
Couple Questions - by El Forum - 05-23-2012, 02:59 PM
Couple Questions - by El Forum - 05-24-2012, 06:05 AM
Couple Questions - by El Forum - 05-24-2012, 06:29 AM
Couple Questions - by El Forum - 05-24-2012, 07:08 AM
Couple Questions - by El Forum - 05-24-2012, 07:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB