title: how to search a table by looping through an array in codeigniter
body: <p>I have an array of names and I need to fetch the full name of each from a database. In the code below I've managed to get a list of the user's friends/pals and then turn that string into an array. But I've failed to fetch the full name of the names in the array, help please :(</p>
  
  <p>Here is my model</p>
  
  <pre><code>public function getPals(){
      $username = $this-&gt;session-&gt;userdata('username');
      $query = $this-&gt;db-&gt;get_where('pals', array('username' =&gt; $username));
  
      foreach ($query-&gt;result() as $row){
  
          $palString = $row-&gt;pal_list;   //returns a string "james,nash" from db
  
          $palsArray = explode(",", $palString);
  
          foreach ($palsArray as $pals) {
  
              $query = $this-&gt;db-&gt;get_where('users', array('username' =&gt; $pals));
  
              foreach ($query-&gt;result() as $row){
  
                  $pal = $row-&gt;full_name;
  
                  //nothing is returned, am pretty sure nash exists in the db
                  echo $pal;
                  echo "&lt;br&gt;";
              }
          }
      }
  }
  </code></pre>