title: Error in echoing inside a td element
body: <p>I am trying to see if an array is empty, so in a <code>&lt;td&gt;</code> I will write: Not Available.<br>
  I have this PHP/PDO code:</p>
  
  <pre><code>$sql1= "SELECT SUM(total_pay) AS total_w FROM workers WHERE date_of_pay = :d1 AND projects_id = :id";
      $stmt1 = $conn-&gt;prepare($sql1);
  
      $stmt1-&gt;bindValue(":d1", $d);
      $stmt1-&gt;bindValue(":id", $id);
      $count1 = $stmt1-&gt;execute();
      $result1 = $stmt1-&gt;fetchAll();
      $num1 = $stmt1-&gt;rowCount();
  </code></pre>
  
  <p>This is my html code:</p>
  
  <pre><code>&lt;?php if($num1==0):?&gt;
  &lt;td align="center"&gt;Not Available&lt;/td&gt;
  &lt;?php else: ?&gt;
  &lt;td align="center"&gt;
  &lt;?php 
  {
      foreach ($result1 as $res1)
      {
          echo $res1['total_w'];
      }
  }
  ?&gt;
  &lt;?php endif; ?&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>When the array is not empty, I have a value, it will be shown in <code>&lt;td&gt;</code> normally but when <code>num1</code> is empty ($num1==0), nothing is shown in <code>&lt;td&gt;</code> even the text of <code>Not Available</code></p>