title: Displaying images correctly
body: <p>How can i display images in a correct way, i'm having difficulties displaying them one by one currently when i put the image its displaying one image instead of different ones.
  this is the code where i want to display an image after it selects the details from the database.</p>
  
  <p><strong>PHP code</strong></p>
  
  <pre><code>  &lt;div class="panel-body" id="panelsection"&gt;
    &lt;?php while($row1 = pg_fetch_array($result1)){ ?&gt;
      &lt;div id="categorymoviesection"&gt;
          &lt;img src="&lt;?php echo $row1[2]; ?&gt;" height="300" width="200"&gt;
          &lt;h5 style="color: #FFFFFF"&gt;&lt;?php echo $row1[1]; ?&gt;&lt;/h5&gt;
          &lt;a href = "moviedetails.php?movieid=&lt;?php echo $row1[0];?&gt;" class = "btn btn-default" id="btndefault" role = "button" style="width: 200px"&gt;
              More details
          &lt;/a&gt;
      &lt;/div&gt;
      &lt;?php  } ?&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p><strong>ALL code</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;?php 
      session_start();
      $name = "";
      $userid = "";
      if(array_key_exists('name', $_SESSION) &amp;&amp; array_key_exists('userid', $_SESSION)){
          $name = $_SESSION['name'];
          $userid = $_SESSION['userid'];
      }
  
  ?&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;?php $page_title = "All Movies" ?&gt;
      &lt;?php include("includes/resources.php");?&gt;
      &lt;?php include ("includes/navbar2.php");?&gt;
        &lt;?php
        require('connect.php');
          $query = "SELECT M.MovieID, M.Name, rank.average
                      FROM (
                          SELECT SUM(W.Rating)/count(W.Rating) AS average, M.MovieID AS mo
                          FROM Movie M, Watches W
                          WHERE M.MovieID = W.MovieID
                          GROUP BY M.MovieID)rank, Movie M
                      WHERE M.MovieID = rank.mo 
                      GROUP BY rank.average, rank.mo, M.Name, M.MovieID
                      ORDER BY M.Name";
  
          $result = pg_query($link,$query);
          $stmt = pg_prepare($link, 'ps',$query); 
  
        ?&gt;
  
  &lt;/head&gt;
  
  &lt;body style="background-color: #212121; padding-bottom: 30px;"&gt;
      &lt;div class="container"&gt;
  
      &lt;h1 style="color: #FFFFFF; margin-left: -45px;"&gt; 
      All available Products:
      &lt;/h1&gt;
  
          &lt;div class="row clearfix"&gt;
  
      &lt;!--Thumbnail for the movies--&gt;
  
      &lt;div class = "row"  id="thumbnailsection"&gt;
  
     &lt;?php while($row = pg_fetch_array($result)) { ?&gt;
  
  
     &lt;div class = "col-sm-6 col-md-3" id="indivthumbnail" &gt;
        &lt;div class = "thumbnail" id="indivthumbnail2" &gt;
           &lt;img src = "&lt;?php  echo $row[3]; ?&gt; " alt = "Generic placeholder thumbnail"&gt;
        &lt;/div&gt;
  
        &lt;div class = "caption" id="caption2"&gt;
           &lt;h4&gt; &lt;?php echo $row[1]; ?&gt; &lt;/h4&gt;
           &lt;p&gt;Rating: &lt;?php  echo $row[2];   ?&gt; &lt;/p&gt;
  
           &lt;p&gt;
           &lt;?php if (1==1){?&gt;
              &lt;a href = "watchedlist.php?movieid=&lt;?php echo $row[0];?&gt;&amp;userid=&lt;?php echo $userid ?&gt;" class = "btn btn-primary" id="btnprimary" role = "button"&gt;
                 Bought
              &lt;/a&gt; 
           &lt;?php } else { ?&gt;
              &lt;a href = "watchedlist.php?movieid=&lt;?php echo $row[0];?&gt;&amp;userid=&lt;?php echo $userid ?&gt;" class = "btn btn-primary" id="btnprimary" role = "button"&gt;
                 Add to wishlist
              &lt;/a&gt; 
              &lt;?php } ?&gt;
              &lt;a href = "moviedetails.php?movieid=&lt;?php echo $row[0];?&gt;" class = "btn btn-default" id="btndefault" role = "button"&gt;
                 More details
              &lt;/a&gt;
           &lt;/p&gt;
  
        &lt;/div&gt;
     &lt;/div&gt;
  
   &lt;?php  } ?&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Results im getting</strong>
  <a href="https://i.stack.imgur.com/YEi0B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YEi0B.png" alt="image result"></a></p>
  
  <p>your help will greatly appreciated, thanks</p>