Welcome Guest, Not a member yet? Register   Sign In
return row to view help

ok, im just having a huge brain fart here... im trying to return a single row to my view, but im missing a step along the way. How do I pass a sinlge row of data from my db threw my controller and into my view page?

Model snip:
public function get_tech_name($id) {
        $query = $this->db->get_where('techs', array('id' => $id));
        $row = $query->row();
        $name = $row->first_name . " " . $row->last_name;
        return $name;      


Controller snip:
public function index()
    $name = $this->users_model->get_tech_name($this->session->userdata('techid'));
    $data['tech_name'] = $name;

    $data['query'] = $this->home_model->get_company_list();

    $this->load->view('home_view', $data);

View: (The Welcome line is where I simply want to print the techs name, but it only prints the first letter of their name, because im doing it the wrong way lol)

<div id="container">
<h2>Welcome, &lt;?php echo $query['fname'];// . " " . $lname; ?&gt;</h2> | Logout Link
<div id="body">
    Company list:
    &lt;?php foreach($query as $item): ?&gt;
   link disabled ="&lt;?php base_url();?&gt;home/view/&lt;?php echo $item['id']; ?&gt;">&lt;?php echo $item['company_name'];     </br>
    &lt;?php endforeach; ?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB