title: Stop table from being generated IF less then X
body: <p>I have a table that is generated upon REST API, I generate for the first 50 in the result. My issue is if the response from REST is less then 50 the table still make the table for 50, just with empty rows on the X amounts that is not available in the response.</p>
  
  <p>So e.g I get result of 47 , then my code generates for 50 still only so last three rows is empty. How do I avoid this ?</p>
  
  <pre><code>  for($x=0;$x&lt;50;$x++)
    echo "&lt;table&gt;&lt;tr&gt;&lt;td&gt;" . "&lt;img style='width:200px; height:150px;' src='" . $imagehost . $newImgUrl = preg_replace($pattern, $replacement, $hotelSummary[$x]['thumbNailUrl']) . "'/&gt;" . "&lt;/td&gt;&lt;td&gt;" . $hotelSummary[$x]['name'] . "&lt;/td&gt;&lt;td&gt;" . $hotelSummary[$x]['hotelId'] . "&lt;/td&gt;&lt;td&gt;" . $hotelSummary[$x]['city'] . "&lt;/td&gt;&lt;td&gt;" . $hotelSummary[$x]['RoomRateDetailsList']['RoomRateDetails']['RateInfos']['RateInfo']['ChargeableRateInfo']['@total'] . "&lt;/td&gt;&lt;td&gt;&lt;a href=\"/hotels/hotelPage.php?go&amp;customerSessionId=$customerSessionId&amp;hotelId=" . $hotelSummary[$x]['hotelId'] . " \"&gt;&lt;button type='button'&gt;Hotel Info&lt;/button&gt;&lt;/a&gt;&lt;td&gt;&lt;a href='" . $hotelSummary[$x]['deepLink'] . "' &gt;&lt;button type='button'&gt;Book Now&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
  </code></pre>
  
  <p>So if the response is less then 50 only create for the x amount found, and if the amount is less then 1 echo out e.g No results matches your search.</p>
  
  <p>Can I implement an if sentence in this or how should I do this ? </p>