I'm using JWPlayer6 (non-commercial version) and I'm facing a serious problem, using a while loop to loop over all videos from a MySQL database using PHP. Unfortunately, the web page just shows one video from MySQL. When I checked the code in Chrome, I saw that inside the <div id='my-video'></div>
, there's nothing to show. How should I fix the problem?
<?php
$result = mysql_query("SELECT * FROM schoolvideo GROUP BY folderName ORDER BY id desc");
while($data = mysql_fetch_array($result)) {
$id = $data['id'];
$video = $data['video'];
$folderName = $data['folderName'];
?>
<div class="square">
<div id='my-video'></div>
<script type="text/javascript">
jwplayer('my-video').setup({
file: 'http://abc.com/video/<?php echo $folderName; ?>/<?php echo $video; ?>',
width: '370',
height: '270',
primary: 'flash',
image: 'http://abc.com/img/poster.png',
autostart: false
});
</script>
</div>
<?php
}
?>