I am retrieving images from database, Now how can i link dynamically images to their url which are also stored in same table, image coloum is adv and url coloum is adv_url , Moreover i dont want to see the url , when i click the image it should go to the that url, ie it should open the link as given in url.

<?php 
    include_once("../init.php");
    validation_check($_SESSION['UID'], SITE_HOME_ADMIN);
    $msg='';
    $adDir ='./'.VIDEO;

$qr = mysql_query("select * from ".VIDEONEWS) or die('Error in connection');
while($rs = mysql_fetch_array($qr))
{
    $adv = '';
    if($rs['adv']!='') {
        $adv = '<img src="'.$adDir.$rs['adv'].'" style="width:300px; height:150px" > ';
    }
    $image = $adv;
 $msg .='<tr> <td>'.$image.'</td> </tr>';
}

?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Videonews Lists</title> <link href="style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="headerstyle.css" /> </head> <body> <div class="fixx"><?php include('header.php');?></div> <div class="tabl"> <table width="100%" border="0" align="center" class="main"> <td> <table width="95%" border="1" align="center" cellpadding="10"> <tr> <td width="65%"><strong>File</strong></td> </tr> <?php echo $msg;?> </table> </td></tr></table> </body> </html>