title: return String from database with CodeIgniter
body: <p>This is my <strong>Model</strong> :</p>
  
  <pre><code>function getAvenuName($id) {
          $this-&gt;db-&gt;distinct();
          $this-&gt;db-&gt;select('admin.username');
          $this-&gt;db-&gt;from('personal_closest');
          $this-&gt;db-&gt;join('admin', 'admin.id = personal_closest.avenu_id', 'left');
          $this-&gt;db-&gt;where('personal_closest.avenu_id', $id);
          $query = $this-&gt;db-&gt;get();
          return $query-&gt;result();        
      }
  </code></pre>
  
  <p>This is my <strong>Controller</strong> :</p>
  
  <pre><code>foreach ($listofcloset['postByUser'] as $key =&gt; $value) { 
              $listofcloset['postByUser'][$key]['calculatetime']   =  $this-&gt;calculatetime(strtotime($value['postdatetime']));
              $listofcloset['postByUser'][$key]['countcomments']   =  $this-&gt;countcomments($value['id']); 
              $listofcloset['postByUser'][$key]['comments']        =  $this-&gt;comments-&gt;sltpostcomments($value['personal_closest_id']); 
              $listofcloset['postByUser'][$key]['countCloset']     =  $this-&gt;closet-&gt;countCloset($value['id']);            
              $listofcloset['postByUser'][$key]['givencool']       =  $this-&gt;checkCoolIsGiven($this-&gt;session-&gt;userdata('user_id'),$value['user_id'],$value['personal_closest_id']);
              $listofcloset['postByUser'][$key]['givencloset']     =  count($this-&gt;closet-&gt;selectIdbycloset($this-&gt;session-&gt;userdata('user_id'),$value['user_id'],$value['personal_closest_id']));
              if (empty($listofcloset['postByUser'][$key]['username'])){
                  $listofcloset['postByUser'][$key]['username'] = $this-&gt;personal_closest-&gt;getAvenuName($value['avenu_id']);
              }
          }
  </code></pre>
  
  <p>When i go to take the username i've a problem with array to string conversion. I'm trying to found a solution to take just the String instaed the array.</p>
  
  <p>That's the result: </p>
  
  <pre><code>[username] =&gt; Array
              (
                  [0] =&gt; stdClass Object
                      (
                          [username] =&gt; USER1
                      )
  
              )
  </code></pre>