title: when i echo session variable (which contains image path) in div tag it isn't displaying all images
body: <p>I have got a database called usermovie where i have stored info about movie (like name, genre, pic, title, fav, etc). When i tried to echo movie pics which are user favourite using currently logged in user id as condition it displays all images perfectly in php page but when i tried to use session variable and echo it in div tag it shows only one pic why is that happening can ayone help me with this ?</p>
  
  <p>my code</p>
  
  <p>usermovie.php</p>
  
  <pre><code>&lt;?php
  require_once 'db.php';
  
  $id = $_SESSION['id'];
  $moviefav = "Yes";
  
  $query = "SELECT movie_pic FROM usermovie WHERE id=? AND movie_fav=?";
  $stmt = $conn-&gt;prepare($query);
  $stmt-&gt;bind_param('is', $id, $moviefav);
  $stmt-&gt;execute();
  $result = $stmt-&gt;get_result();
  while($row = $result-&gt;fetch_assoc()) {
      echo "&lt;img src=" . $row['movie_pic'] . "&gt;";
  
  $usermovieFav = "&lt;img src=" . $row['movie_pic'] . "&gt;"
   $_SESSION['usermovieFav'] = $usermovieFav;
  
  }
  ?&gt;
  </code></pre>
  
  <p>I have stored five movies and selected all five movies as fav above code perfectly displays all five pics when i open usermovie.php but when i use the above session variable and try to echo it in div tag it only shows one pic which is stored last in database why is that happening i want to display all five pics in index.php</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;div&gt;
  &lt;?php echo $_SESSION['usermovieFav']; ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thank you</p>