title: How make a table with php using the echo command with looping data?
body: <p>I want to make a nice looking table for my SQL data.</p>
  
  <p>I load in my data like this now:</p>
  
  <pre><code>$sql = "SELECT mednr, mednaam, medvoornaam , medemail, ploeg, medgeslacht FROM Medewerker, Ploeg WHERE medploeg = ploegnummer";
  
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
  
      // output data of each row
      while($row = $result-&gt;fetch_assoc()) {
          if ($row["ploeg"] == "Tapper") {
          echo 
      "&lt;td class='link2'&gt;" . $row["mednaam"] . "&lt;/td&gt;".
      "&lt;td class='link2'&gt;" . $row["medvoornaam"] . "&lt;/td&gt;".
      "&lt;td class='link2'&gt;" . $row["medemail"] . "&lt;/td&gt;".
      "&lt;td class='link2'&gt;" . $row["ploeg"] . "&lt;/td&gt;".
      "&lt;td class='link2'&gt;" . $row["medgeslacht"] . "&lt;/td&gt;".
  
          '&lt;form id="delete" method="post" action=""&gt;'.
          '&lt;input type="hidden" name="delete_rec_id" value="&lt;?php print $id; ?&gt;"/&gt;'.
          '&lt;input type="submit" name="delete" value="Delete"/&gt;'."&lt;/form&gt;".
      "&lt;/br&gt;"."&lt;/hr&gt;";
              ;
      }
      }
  } else {
      echo "0 results";
  }
  </code></pre>
  
  <p>But I want to make a nice looking table. The problem is that the echo keeps looping the data so I cant make <code>&lt;table&gt;</code> and <code>&lt;td&gt;</code> tags because it will create a table and td for each piece of data.</p>
  
  <p>I know from jQuery were I could use <code>$append</code> to put the data inside a certain tag.</p>
  
  <p>Is there any way I could do this with PHP?</p>
  
  <p>(I'm very new to PHP and programming in general so please excuse me for this simple question).</p>