title: How to get data into the view without foreach in codeigniter?
body: <p>My Controller:  </p>
  
  <pre><code>public function contact()
      {   
              $data =array();
              $this-&gt;load-&gt;model('contentModel');
              $data['reachus']=$this-&gt;contentModel-&gt;reachusviewModel();
              $data['socialnetworks']=$this-&gt;contentModel-&gt;socialnetworkviewModel();
              $data['background1']=$this-&gt;contentModel-&gt;contactbackgroundviewModel();
              $result=$this-&gt;load-&gt;view('contact',$data);
              /*$this-&gt;load-&gt;view('contact');*/
      }
  </code></pre>
  
  <p>my model:   </p>
  
  <pre><code> public function contactbackgroundviewModel()  
      {  
  
          $this-&gt;db-&gt;select("*");
          $this-&gt;db-&gt;from('contactbackground');  
          $query = $this-&gt;db-&gt;get();
          return $result=$query-&gt;result();  
      }
  </code></pre>
  
  <p>My view:  </p>
  
  <pre><code>   &lt;?php  
       foreach ($background1 as $row)  
       {  
  
              echo $row-&gt;image; 
         }
  ?&gt;
  </code></pre>
  
  <p>My requirement is I have only just one value to be printed. how should I avoid foreach, how the data should be printed in the view?</p>
  
  <p>thanking in advance</p>