title: Only Returning 1 Item
body: <p>Can someone help me as i'm new to php?</p>
  
  <p>I'm running a movie site that using smarty template engine and what i'm trying to do is return and display all categories foreach movie  but what happens is it displays the same category 'Comedy' for all movies when i use this</p>
  
  <p>The functions</p>
  
  <pre><code>public function getByPerma($perma, $lang=null){
      $perma = mysql_real_escape_string($perma);
      $movie = array();
      $e = mysql_query("SELECT * FROM movies WHERE perma='$perma'") or die(mysql_error());
      if (mysql_num_rows($e)&gt;0){
          $movie = $this-&gt;formatMovieData(mysql_fetch_assoc($e), $lang);
      }
      return $movie;
  }
  
  public function getMovieCategoryDetails($movieid,$lang=null){
      $movieid = mysql_real_escape_string($movieid);
      $e = mysql_query("SELECT * FROM movie_tags WHERE id IN (SELECT tag_id FROM movie_tags_join WHERE movie_id=$movieid)") or die(mysql_error());
      $tags = array();
      if (mysql_num_rows($e)){
          while($s = mysql_fetch_array($e)){
              $s['tag'] = json_decode($s['tag'],true);
              if ($lang){
                  $s['tag'] = $s['tag'][$lang];
              }
  
              $tags[$s['id']] = $s;
          }
      }
      return $tags;
  }
  </code></pre>
  
  <p>Called the function</p>
  
  <pre><code>$movies = $movie-&gt;getByPerma($perma,$language);
  if (empty($movies)) {
      $movies = '';
  } else {
  
      $tags = $movie-&gt;getMovieCategoryDetails($movies['id'],$language);
      if (!count($tags)){
          $smarty-&gt;assign("tags","");
      } else {
          $smarty-&gt;assign("tags",$tags);
      }
  } 
  </code></pre>
  
  <p>And displaying the categories</p>
  
  <pre><code>{foreach from=$tags key=id item=val name=tags}
      {$val.tag}
  {/foreach}
  </code></pre>
  
  <p>I hope someone can help?</p>