title: MYSQL QUERY and display output to html
body: <p>I want to show the total rating of each company and total will put on specific category</p>
  
  <p>the code is this</p>
  
  <pre><code>if (isset($_POST['search'])){
  
      $key = $_POST['keyword'];
  
      $com = mysql_query("
  SELECT * 
    FROM company
   WHERE id LIKE '%$key%' 
      OR name LIKE '%$key%' 
      OR address LIKE '%$key%' 
      OR city LIKE '%$key%' 
      OR province LIKE '%$key%' 
      OR region LIKE '%$key%' 
      OR country LIKE '%$key%' 
      OR description LIKE '%$key%'
   ");
      while($comshow = mysql_fetch_array($com)){
          $comshowid = $comshow['id'];
  
          echo '
      &lt;form  method="POST"&gt;   
      &lt;div class = "row"&gt;
  &lt;div class = "text-right"&gt;                      
      &lt;b&gt;&lt;input  name = "reviewid" style = "margin-right:50%;" class = "text-right" id = "id" type = "text" value = "'.$comshow['id'].'" readonly&gt;&lt;/b&gt;                    
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class = "row" style = "margin-left:1%;"&gt;
      &lt;div class ="col-md-4"&gt;
          &lt;img src = "'.$comshow['dp'].'" style = "width:80%;"&gt;
      &lt;/div&gt;
      &lt;div class = "col-md-6"&gt;
  
          &lt;h2&gt;&lt;i&gt;'.$comshow['name'].'&lt;/i&gt;&lt;/h2&gt;
          &lt;hr /&gt;
          &lt;p&gt;'.$comshow['description'].'&lt;/p&gt;
          &lt;h4&gt;&lt;b&gt;Ratings&lt;/b&gt;&lt;/h4&gt;
          &lt;p&gt;Recruitment:&lt;/p&gt;
          &lt;p&gt;Tenure:&lt;/p&gt;
          &lt;p&gt;Separation:&lt;/p&gt;  
          &lt;input class = "btn btn-info" type = "submit"  name ="review" value = "REVIEW"&gt;
      &lt;/div&gt;                      
  &lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;/form&gt;
  
      ';
  
      }
  </code></pre>
  
  <p>This is the rating table
  <a href="https://i.stack.imgur.com/b3r9A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b3r9A.png" alt="enter image description here"></a></p>
  
  <p>This is the company table
  <a href="https://i.stack.imgur.com/DKuLx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DKuLx.png" alt="enter image description here"></a>
  That is the output
  <a href="https://i.stack.imgur.com/3p2XI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3p2XI.png" alt="enter image description here"></a></p>