I'm new to this forum and to PHP and have what is likely quite a trivial problem. I've been trying to create a video playlist that is dynamically created using PHP and MySQL. The code that I have below makes sense to me but it doesn't generate the playlist at all. I was wondering if any of you guys could be able to give me some quick help and let me know what's going on.
Cheers,
Patrick
Code: Select all
<div id = "video_list">
<h1>Video List</h1>
<hr>
<?
$user="usr";
$password="psword";
$database="dbname";
$server="server";
mysql_connect($server,$user,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT * FROM playlist";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=1;
while ($i < $num) {
$author=mysql_result($result,$i,"author");
$date=mysql_result($result,$i,"date");
$description=mysql_result($result,$i,"description");
$url=mysql_result($result,$i,"url");
$img=mysql_result($result,$i,"img");
?>
<div id= "<? echo $i; ?>" class="video_info">
<div id = "video_info">
<p><author><? echo $author; ?></author> <date><? echo $date; ?></date><br>
<p><discription><? echo $description; ?></discription>
</div>
<dif id = "video_icon">
<p><a href="<? echo $url; ?>"><img src ="<? echo $img; ?>"></a>
</div>
<div>
<hr>
<?
$i++;
}
?>
</div><!-- end video list -->