Hi all i have one problem to display divs according to mysql query
i have the following code please help me how to display two divs like this with mysql
<?php $query="select distinct(type) from news_category";
$res=mysql_query($query);
$row=mysql_num_rows($res);
//echo $row;
$string = '<div style="float:left" class="news_box">';
$string1 = '<div style="float:right" class="news_box">';
while($rows=mysql_fetch_array($res,MYSQL_BOTH))
{
$type=$rows['type'];
$i=0;
$i=$i+1;
if($row==1)
{
echo $string;
?>
<div class="news_box_top"><?php echo $type; ?></div>
<div class="news_box_pan"><div class="small_ad_box"></div>
<ul>
<li><a href="#">df sdfsf sdfsd fsdf sfsdf sfsdf sfsdf fsf gsf sf sfsdf sfsdf sfdsf sfdsfsf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sff sfs fsfsfsf sdfsfs fsf sfsdf sfsf sf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sfsf f sfdsf sfsfsf sfsf sfs fsdf sfds fsdf sfsf sdf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sfs sfsdf sfsd fsfsf sfsdf sfs sfsf sfsf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fssf sfdsf sffsfs fsfsdf sfsf sfsf sdf sfsf sfs</a></li>
</ul>
</div>
<div class="news_box_btm"></div>
</div> <?php }
if($row==2) {
echo $string1;
?>
<div class="news_box_top"><?php echo $type; ?></div>
<div class="news_box_pan"><div class="small_ad_box"></div>
<ul>
<li><a href="#">df sdfsf sdfsd fsdf sfsdf sfsdf sfsdf fsf gsf sf sfsdf sfsdf sfdsf sfdsfsf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sff sfs fsfsfsf sdfsfs fsf sfsdf sfsf sf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sfsf f sfdsf sfsfsf sfsf sfs fsdf sfds fsdf sfsf sdf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fsdf sfs sfsdf sfsd fsfsf sfsdf sfs sfsf sfsf sfs</a></li>
<li><a href="#">df sdfsf sdfsd fssf sfdsf sffsfs fsfsdf sfsf sfsf sdf sfsf sfs</a></li>
</ul>
</div>
<div class="news_box_btm"></div>
</div>
<div class="ad_box" style="width:730px;height:100px;padding-top:10px;margin-top:10px"><h2>Advertisement</h2></div>
<?php }} ?>