title: Check if any row of the group by is empty
body: <p>I am checking all rows of the <code>group by</code> <code>$b</code>, In-case of empty row in <code>$b</code> I want to disable the button of group column <code>$a</code>, as in the following script. And I am using <code>group by</code> that's why it is only working on the first row of <code>$b</code>.
  How to disable button of a group column if any of it row is empty?<br>
  And should I use loop to check all the rows of <code>$b</code>.</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>$id = $_POST['id'];
          $sql = $db-&gt;prepare("SELECT a, b from table  WHERE id = :id group by a");
          $sql -&gt;bindparam(':id',$id);
          $sql -&gt;execute();   
          while($row = $sql -&gt;fetch(PDO:: FETCH_ASSOC) ) {
                  $a = $row['a'];
                  $b = $row['b'];
                  if(!empty ($b))
                      {
                          echo '&lt;tr&gt;
                          &lt;td&gt;&lt;input type="button" name="a[]" value="'.$a.'"&gt;&lt;/td&gt;
                          &lt;/tr&gt;';
                      }else{
                          echo '&lt;tr&gt;
                          &lt;td&gt;&lt;input type="button" name="a[]" value="'.$a.'" disabled&gt;&lt;/td&gt;
                          &lt;/tr&gt;';
                      }
  
          } // while
  </code></pre>