I need to pull information from a db table for a slideshow on my page, and need a little help.
All of the {$image}'s need to be pulled out and displayed in a div#slider first, then if $caption is set to 1, the caption info is displayed in a div#htmlcaption after the images div#slider.
I have an example of the divs below the mysql query, but I'm not sure how to insert it into the while loop.
TIA
<?php
$sql = mysql_query("SELECT * FROM slideshow");
if(mysql_num_rows($sql) > 0) {
while($row = mysql_fetch_assoc($sql)) {
$slideID = $row['slideID'];
$image = $row['image'];
$caption = $row['caption'];
$caption_h3 = $row['caption_h3'];
$caption_content = $row['caption_content'];
$caption_link = $row['caption_link'];
$caption_link_text = $row['caption_link_text'];
}
}
?>
<div id="slider">
<img src="{$image}" alt="" title="#htmlcaption{$slideID}" />
<img src="{$image}" alt="" title="#htmlcaption{$slideID}" />
<img src="{$image}" alt="" title="#htmlcaption{$slideID}" />
</div>
<div id="htmlcaption{$slideID}" class="nivo-html-caption">
<h3>$caption_h3</h3>
<p>$caption_content</p>
if($caption_link != '') {
<p><a href="{$caption_link}">{$caption_link_text}</a></p>
}
</div>