title: How to group and show multiple resultset row values within a single table cell?
body: <pre><code>&lt;?php
  include("functions/functions.php");
  $con=mysqli_connect("localhost", "root", "", "db_stvs");
  $query="select * from tbl_preset_position where pp_status='Active'";
  $query1="select distinct pp_name from tbl_preset_position where pp_status='Active'";
  $res=mysqli_query($con, $query);
  $res1=mysqli_query($con, $query1);
  ?&gt;
  &lt;button class="btn btn-primary"&gt;Back&lt;/button&gt;
  &lt;button class="btn btn-primary" data-toggle="modal" data-target="#addModal"&gt;Add Position Preset&lt;/button&gt;
  
  &lt;table class="table-bordered"&gt;
      &lt;th&gt;Preset Name&lt;/th&gt;
      &lt;th&gt;Positions Available&lt;/th&gt;
      &lt;?php
      while ($row1 = mysqli_fetch_assoc($res1)) {
      ?&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;?php echo $row1['pp_name'];?&gt;
              &lt;/td&gt;
              &lt;td&gt;
              &lt;?php
              while ($row= mysqli_fetch_assoc($res)) {
                  if($row['pp_name']==$row1['pp_name']) {
                      echo $row['pp_position']."&lt;br&gt;";
                  }
                  ?&gt;
                  &lt;?php
              }
              echo "&lt;/td&gt;&lt;/tr&gt;";
      }
      ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I can display the first row with its position, but when it comes to the other rows, no data is showing.</p>
  
  <p>I just wanted to display the certain position on the right preset name.
  for example:-</p>
  
  <pre><code>" Sample preset has 3 Positions 
  "Sample Preset| President, Vice PResident" 
  "Sample Preset 2| Supremo, Ala Supremo"
  </code></pre>