Pulling info from database and dynamically adding them into different divs
- by Matt Nathanson
This may be a bit of a php n00b question but i've managed to get it working this far and I'm a little bit stuck.  I'm pulling 12 images with descriptions out of a database.  I want to insert them into a client rotator that has 3 sets of 4.  They will be contained in divs called  clientrotate1, clientrotate2, and clientrotate3  respectively. Inside each of those divs I want to have 4 images with classes thumb1, thumb2, thumb3, and thumb4  I am successful in having the images and descriptions pull into clientrotator 1.  Where I get stuck is to how to dynamically add the 2nd and 3rd set of data into clientrotator2 and clientrotator3.
Here is my function:
        public function DisplayClientRotator(){
    $result = mysql_query( 'SELECT * FROM project ORDER BY id DESC LIMIT 12' )
    or die("SELECT Error: ".mysql_error());
    $iterator = 1;
    while ($row = mysql_fetch_assoc($result)) {
        echo "<div id='clientrotate1'>";
        echo "<div class='thumb$iterator'>";
        echo "<img style='width: 172px; height: 100px;' src=".$row['photo']." />";
        echo "<div class='transbox'>";
        echo "<div class='thumbtext'>";
        echo $row['campaign'];
        echo "</div>";          
        echo "</div>";
        echo "</div>";
        echo "</div>";
        $iterator++;
    }
Any help or pointers int he right direction would be greatly appreciated!
Thanks so much, Matt