title: How to get the row number for each item returned
body: <p>I am trying to use the XSwitch jquery script and dynamically create the "section id" automatically but am stuck. </p>
  
  <p>How do I give each section an "id" starting at 0? Some items have 2 or 3 images, some have 30+.</p>
  
  <pre><code>$result = mysqli_query($conn,"SELECT * FROM Images WHERE stock=".$_GET['stock']." ORDER BY orderIndex");
  while($row = mysqli_fetch_array($result)){
    $count = $result-&gt;num_rows;
    if ($count) {
      $photos .= '&lt;div class="section" id="section__NEED___NUMBER" style="background-image: url(inventory/'.$category.'/large/'.$stock.'_'.$row['id'].'.jpg)"&gt;&lt;/div&gt;';
    } else {
      $photos = 'No Photos are currently available';
    }
  }
  </code></pre>