title: Wrapping results in Table
body: <p>I have a php code that is echoing results from a database.
  Code here:</p>
  
  <pre><code>&lt;?php
  
     $db = new mysqli("localhost", "root", "", "garyline_master");
  
     if(isset($_GET['keywords'])) {
  
          $keywords = $db-&gt;escape_string($_GET['keywords']);
  
          $query = $db-&gt;query("
              SELECT productID, productName, description
              FROM promo
              WHERE productID LIKE '%{$keywords}%'
              OR productID LIKE '%{$keywords}%'
          ");
     ?&gt;
  
     &lt;div class="resul-count"&gt;
      Found &lt;?php echo $query-&gt;num_rows; ?&gt; Results.
      &lt;/div&gt;
  
      &lt;table border="1" align="center"&gt;   
      &lt;?php
  
          if($query-&gt;num_rows){
              while($r = $query-&gt;fetch_object()){
              ?&gt;
              &lt;div class="result"&gt;
                      &lt;tr&gt;&lt;?php 
                      echo $r-&gt;productID;
                      echo $r-&gt;productName;
                      echo $r-&gt;description;
              ?&gt;
              &lt;/tr&gt;
                  &lt;/div&gt;
      &lt;/table&gt;
              &lt;?php
          }
  
  }
  }   
  ?&gt;
  </code></pre>
  
  <p>I'm trying to figure out the proper way to write the code. to wrap the results in a table  Any help is greatly appreciated </p>