title: PHP there's only 1 row is returned then duplicates it
body: <p>I was wondering if anyone can explain to me why its only returning 1 row when there are 5 different rows in mysql table.</p>
  
  <p>It's only showing the 1st row in all 5 rows, because I placed it in a while loop (HTMLcode) so that it can print all the other rows not just the first one. </p>
  
  <p><a href="http://i.stack.imgur.com/74gLc.jpg" rel="nofollow">Image that shows the problem</a>
  <br/>
  <br/>
  THANK YOU IN ADVANCE :)
  <br/>
  <br/>
  PHP CODE</p>
  
  <pre><code>$id = session_id();
  if ($id == "") {
      session_start();
  }
  if (!isset($_SESSION['username'])) {
      header("Location: login.php");
  }
  
  // making the connection to the database
  try {
      $host = '127.0.0.1';
      $dbname = 'webdev_2014376';
      $user = 'root';
      $pass = '';
      # MySQL with PDO_MYSQL
      $DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
  } catch(PDOException $e) {echo 'Error';}  
  
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  // selecting the row from the database
  $sqlQuery = $DBH-&gt;prepare("SELECT * FROM users");   
  
  // running the SQL
  $sqlQuery-&gt;execute();
  // pulling the data into a variable
  $row = $sqlQuery-&gt;fetch(PDO::FETCH_ASSOC);
  
  // taking each individual piece
  $UserID = $row['UserID'];
  $username = $row['Username'];
  $firstname = $row['FirstName'];
  $lastname = $row['LastName'];
  
  ?&gt;
  </code></pre>
  
  <p><br/>
  <br/>
  HTML CODE</p>
  
  <pre><code>&lt;?php
       echo 'hello, ' . $_SESSION['username'];
       echo '            ';
       echo $_SESSION['id'];
  ?&gt;
  
              &lt;div&gt;   
                 &lt;table class="table table-bordered table-hover"&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th class="TableCol1"&gt; Username &lt;/th&gt;
                              &lt;th class="TableCol2"&gt; First Name &lt;/th&gt;
                              &lt;th class="TableCol3"&gt; Last Name &lt;/th&gt;
                              &lt;th class="TableColOpt"&gt; Options &lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;
                          &lt;?php
                          while ($check)  {
                              echo '&lt;tr&gt;';
                              echo '&lt;td class="prEach1"&gt;' . $username . '&lt;/td&gt; ';
                              echo '&lt;td class="prEach1"&gt;' . $firstname . '&lt;/td&gt; ';
                              echo '&lt;td class="prEach3"&gt;' . $lastname . '&lt;/td&gt; ';
                              echo '&lt;td class="prEach4 optlinks"&gt; '
                              . '&lt;a href="profile.php?UserID='.$UserID.'"&gt;View&lt;/a&gt; '
                              . '&lt;/td&gt;';
                              echo '&lt;/tr&gt;';
  
                              $check = $sqlQuery-&gt;fetch(PDO::FETCH_ASSOC);
                          }
                          ?&gt;
                      &lt;/tbody&gt;
                  &lt;/table&gt; 
              &lt;/div&gt;
  </code></pre>
  
  <p><br/>
  <br/>
  <strong>-------------------------------------------------------
  <br/>EDIT
  <br/>
  <br/>
  I FOUND THE SOLUTION</strong></p>
  
  <p><a href="http://i.stack.imgur.com/7Q2DF.jpg" rel="nofollow">SOLUTION IMAGE</a></p>
  
  <p><br/>
  PHP CODE</p>
  
  <pre><code>&lt;?php
  $id = session_id();
  if ($id == "") {
      session_start();
  }
  if (!isset($_SESSION['username'])) {
      header("Location: login.php");
  }
  
  // making the connection to the database
  try {
      $host = '127.0.0.1';
      $dbname = 'webdev_2014376';
      $user = 'root';
      $pass = '';
      # MySQL with PDO_MYSQL
      $DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
  } catch(PDOException $e) {echo 'Error';}  
  
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  // selecting the row from the database
  $sqlQuery = $DBH-&gt;prepare("SELECT * FROM users");
  
  // running the SQL
  $sqlQuery-&gt;execute();
  // pulling the data into a variable
  $check = $sqlQuery-&gt;fetch(PDO::FETCH_ASSOC);
  
  
  
  ?&gt;
  </code></pre>
  
  <p><br/>
  HTML CODE</p>
  
  <pre><code>&lt;?php
  echo 'hello, ' . $_SESSION['username'];
  echo '            ';
  echo $_SESSION['id'];
  ?&gt;
  
  &lt;div&gt;   
     &lt;table class="table table-bordered table-hover"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th class="TableCol1"&gt; Username &lt;/th&gt;
                  &lt;th class="TableCol2"&gt; First Name &lt;/th&gt;
                  &lt;th class="TableCol3"&gt; Last Name &lt;/th&gt;
                  &lt;th class="TableColOpt"&gt; Options &lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;!-- This is the category fields on the list. --&gt;
          &lt;tbody&gt;
              &lt;?php
              //$check = $sqlQuery-&gt;fetch(PDO::FETCH_ASSOC);
              while ($check)  {
  
                  echo '&lt;tr&gt;';
                  echo '&lt;td class="prEach1"&gt;' . $check['Username'] . '&lt;/td&gt; ';
                  echo '&lt;td class="prEach1"&gt;' . $check['FirstName'] . '&lt;/td&gt; ';
                  echo '&lt;td class="prEach3"&gt;' . $check['LastName'] . '&lt;/td&gt; ';
                  echo '&lt;td class="prEach4 optlinks"&gt; '
                  . '&lt;a href="profile.php?UserID='.$check['UserID'].'"&gt;View&lt;/a&gt; '
                  . '&lt;/td&gt;';
                  echo '&lt;/tr&gt;';
  
                  $check = $sqlQuery-&gt;fetch(PDO::FETCH_ASSOC); //THIS SHOULD BE AT THE BOTTOM JUST BEFORE THE WHILE LOOP ENDS
              }
              ?&gt;
          &lt;/tbody&gt;
          &lt;!-- This is the get methods of the properties, where the output of the user put in the Property form will be shown --&gt;
      &lt;/table&gt; 
  &lt;/div&gt;
  </code></pre>