Q:

php while loop slider with javascript

I have a slider on my site that is supposed to look similar to this: 
But all I can get it to do is this: 
Can someone help me figure out what is wrong with the php code? I have tried putting it all in one while loop, but then it only shows one of the bubbles on the left and one bubble on the right. I think it throws everything else out of the slider, but I don't get what I am supposed to do. 
I have tried moving around the beginning and endings of tags, not that it did anything, but that is how much I have tried everything. I put an echo before the second while ($record->MoveNext()){ and it printed to the screen, then put it after that same while and it didn't show up. 
It must be the addition of the MoveNext function, but I would like a second opinion since I don't know anything about functions, have no idea where to find them in this site, and wouldn't know how to fix it anyway. :/
I will continue searching the files to see where the MoveNext function is at so I can try to fix it myself, but if someone out there has more experience with this type of stuff than I do, I would really appreciate a step in the right direction if you have advice to offer!
$record = Database::Execute($sql);
if ($record->Count() > 0) {
    print '<div class="flexslider cf">'; 

    print '<ul class="controls">';
    while ($record->MoveNext()) {
        print '<li class="cf"><a href="#"><div class="thumb"><img src=' . $uploadFolder . $record->mk_left_image . ' alt=' . $record->mk_tagline . ' class="left" /></div>';
        print '<div class="text"><h3>' . $record->mk_name . '</h3><p>' . $record->mk_description . '</p></div></a></li>';
    }// end while
    print '</ul>';
    while ($record->MoveNext()){
        print '<ul class="slides">';
            print '<li><div class="img"><img src=' . $uploadFolder . $record->mk_left_image . ' alt=' . $record->mk_tagline . ' class="left" /></div>';
            print '<div class="text"><h2>'. $record->mk_name .'</h2><p>'. $record->mk_description .'</p><a href="#" class="mklink">Continue &raquo;</a></li></ul>'; 
    }// end while

    print '</ul></div>'; 
}
?>

<script type="text/javascript">
$(window).load(function() {
    $('.flexslider').flexslider({
        animation: "fade",
        manualControls: "ul.controls li"
    });
});
</script>

//------------------------------
public function MoveNext() {
//------------------------------
    if ($this->index < $this->count - 1) {
        $this->index++;
            return true;
} else {
    $this->index = $this->count;
        return false;
}
}

A:

Once I found the function MoveNext(), I also found functions for Move(), MovePrevious(), and MoveFirst(). I played around with them and discovered that the second MoveNext() in my code should be the function MovePrevious() and got it working just fine. I guess it just took a post to stackoverflow for me to get my brain walking through the steps. Sometimes it easier to write it down to find out the answer rather than just staring at the monitor for 20 minutes. Hmmmm....
//------------------------------
public function MovePrevious() {
//------------------------------
    if ($this->index > 0) {
        $this->index--;
        return true;
    } else {
        $this->index = -1;
        return false;
    }
}

