title: PHP with Bootstrap Carousel
body: <p>Im trying to learn PHP and using it with the Bootstrap library for my site.  I am looking to use the bootstrap carousel as seen <a href="http://getbootstrap.com/javascript/#carousel" rel="nofollow">here</a></p>
  
  <p>What I am trying to achieve is the carousel with captions and the Machine Name I am showing in the picture would be a hyperlink that will take you to that page for more info.  I have a MySQL database that contains the machine name and the ImagePath as to where it is located.</p>
  
  <p>So my code currently is as below -</p>
  
  <pre><code>&lt;?php
                  while($row = mysql_fetch_array($result))
                  {
          ?&gt;
        &lt;div class="bs-example"&gt;
        &lt;div id="carousel-example-captions" class="carousel slide" data-ride="carousel"&gt;
          &lt;ol class="carousel-indicators"&gt;
            &lt;li data-target="#carousel-example-captions" data-slide-to="0" class="active"&gt;&lt;/li&gt;
            &lt;li data-target="#carousel-example-captions" data-slide-to="1"&gt;&lt;/li&gt;
            &lt;li data-target="#carousel-example-captions" data-slide-to="2"&gt;&lt;/li&gt;
          &lt;/ol&gt;
            &lt;img data-src="holder.js/900x800/auto/#777:#777" style="height: 400px; width: 400px;" alt="First slide image" src="&lt;?php echo $row['MachineImagePath'] ?&gt;"/&gt;
       &lt;div class="finlay-carousel-caption"&gt;
          &lt;h3&gt;&lt;?php echo $row['MachineName']?&gt;&lt;/h3&gt;
            &lt;div&gt;
              &lt;p&gt;
               Click the link above for more details about &lt;?php echo $row['MachineName']&gt;
              &lt;/p&gt;
            &lt;/div&gt;
                  &lt;a class="left carousel-control" href="#carousel-example-captions" data-slide="prev"&gt;
            &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt;
          &lt;/a&gt;
          &lt;a class="right carousel-control" href="#carousel-example-captions" data-slide="next"&gt;
            &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;
          &lt;/a&gt;
        &lt;/div&gt;
       &lt;/div&gt;
        &lt;/div&gt;
          &lt;?php
                  }
                  mysql_close($connection);
          ?&gt;
  </code></pre>
  
  <p>Currently instead of placing each image inside the carosuel this is creating a new carousel for each image down the page.  Should the <code>&lt;carousel-example-captions&gt;</code> html be outside the while loop so it is created once and then the img tag will pick up the new image for each slide as you click the next > and prev &lt; buttons.</p>
  
  <p>Note also - <code>&lt;h3&gt;&lt;?php echo $row['MachineName']?&gt;&lt;/h3&gt;</code> - I have not yet turned the header into a hyperlink as I wanted to get the carousel working correctly first.</p>