title: How to rendering different markup for each record from mysql select?
body: <p>I have a set of items to select from mysql. And then I want to display these items on my page with different 'markup`. </p>
  
  <p>This is how my HTML look like for each item. </p>
  
  <pre><code>&lt;ul class='unstyled main-facilities row'&gt;
      &lt;li class='info-facility-item '&gt;
          &lt;span class='fa-stack'&gt;
              &lt;i class='fa fa-square fa-stack-2x'&gt;&lt;/i&gt;
              &lt;i class='fa fa fa-cutlery fa-stack-1x fa-inverse'&gt;&lt;/i&gt;
          &lt;/span&gt; Item-01
      &lt;/li&gt;
      &lt;li class='info-facility-item '&gt;
          &lt;span class='fa-stack'&gt;
              &lt;i class='fa fa-square fa-stack-2x'&gt;&lt;/i&gt;
              &lt;i class='fa fa fa-rss fa-stack-1x fa-inverse'&gt;&lt;/i&gt;
          &lt;/span&gt; Item-02
      &lt;/li&gt;
      &lt;li class='info-facility-item '&gt;
          &lt;span class='fa-stack'&gt;
              &lt;i class='fa fa-square fa-stack-2x'&gt;&lt;/i&gt;
              &lt;i class='fa fa-refresh fa-stack-1x fa-inverse'&gt;&lt;/i&gt;
          &lt;/span&gt; Item-03
      &lt;/li&gt;
      ...
      ...
      ...
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>If I have same markup for each item, then I can do it like this: </p>
  
  <pre><code>// Fetch all the records:
  while ($stmt-&gt;fetch()) {
  
      $result  = "&lt;li class='info-facility-item '&gt;\n";
      $result .= "    &lt;span class='fa-stack'&gt;\n";
      $result .= "        &lt;i class='fa fa-square fa-stack-2x'&gt;&lt;/i&gt;\n";
      $result .= "        &lt;i class='fa fa fa-rss fa-stack-1x fa-inverse'&gt;&lt;/i&gt;\n";
      $result .= "    &lt;/span&gt;{$item}\n";
      $result .= "&lt;/li&gt;\n";
      $items[] = $result;     
      }           
  }   
  </code></pre>
  
  <p>But I am not sure how to modify my <code>while</code> loop to render different markup for each item. </p>
  
  <p>Can anybody tell me is there a way to do this in PHP? </p>
  
  <p>Thank you. </p>