[eluser]Tanag[/eluser]
Really simple question here. I'm making a call to my database that grabs a single record based on a user ID. I can't seem to read that record on my view without using a loop though. Im sure I just don't have the really simple syntax right, but I can't get it.
Here is my controller code:
Code:
$this->db->where('user_id', $data['users']);
$data['query'] = $this->db->get('users');
$this->load->view('welcome_view', $data);
That works fine, and I can view the data if I do this:
Code:
<?php foreach($query->result() as $row): ?>
<p><?=$row->user_id?></p>
<p><?=$row->class?></p>
<?php endforeach; ?>
But using a loop seems pointless. I know there will always be one record as the user_id is my unique field.
So how can I read the data like $query->result() as $row does. Like I want something like $query->user_id.
Any help would be great, thanks. Im sure its a simple solution and I am a dummy.