leeboycymru
Programmer
I have a loop that only needs to bring out 3 hotels from the database which is set here:
$mPageSize = @$HTTP_POST_VARS["txtPageSize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
{
$mPageSize = @$HTTP_GET_VARS["pagesize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
$mPageSize = 3;
}
I'll post the loop below next, but whats happening is that it is displaying 3 in a row, but for some reason it goes the extra 1 which creates another but empty hotel, and so creating a new row beneath the 1st row which is pushing my footer down. Can anybody help:
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
<?php
if(!$mRecordCount == 0) {
?>
<?php } ?>
<tr>
<td> </td>
</tr>
<?
if($records>0)
{
$cnt=$records+(3-$records%3);
$i=1;
for($i=1;$i<$cnt;$i++) { ?>
<tr>
<td><table border="0" align="left" cellpadding="0" cellspacing="0" width="98%" >
<?
if(($i%3)==0 || $i==1 ){ ?>
<tr>
<? for($j=1;$j<=3;$j++) {
$morevalue=true;
$rows=mysql_fetch_assoc($result) or $morevalue=false;
?>
<td width="<? if($j==1) { print("228"); } else { print("242"); } ?>" align="left" valign="top"><table width="217" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="middle"><table width="201" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="62" height="63" align="left" valign="top">
<? if($morevalue){
if(is_file("../admin1212/".$rows['foto1']))
{
imgresize("../admin1212/$rows[foto1]");
?> <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>" class="bodySmall1"><img src="../admin1212<?=$rows['foto1']?>" alt="" height="80" width="80" border="0"/></a>
<? }} ?> </td>
<td width="7"> </td>
<td width="132" align="left" valign="top"><span class="bahia">
</span><span class="bahia">
<? if($morevalue){ ?>
<?=$rows['hotel_name']?>
<? } ?>
</span><br>
<? if($morevalue){ ?>
<?php $int=strlen($rows['star_rating']);
if($int>0) { $k=0; while($k<$int) { ?>
<img src='images/star.gif' border='0' alt="" />
<?php $k++; } } ?>
<? } ?>
<br> <span class="maxico">
<? if($morevalue){ ?>
<?=$rows['country']?>
<? } ?>
</span><br>
<span class="bodySmall1">
<? if($morevalue){ ?>
<a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>" class="bodySmall1">More Info</a>
<? } ?>
</span></td>
</tr>
</table></td>
</tr>
if($morevalue){ ?>
<tr>
<td height="1" align="left" valign="top" bgcolor="#CCCCCC"></td>
</tr>
<? } ?>
</table></td>
</tr>
</table></td>
<? if(($j==1||$j==2) && $morevalue) { ?>
<td width="1" bgcolor="#CCCCCC"></td>
<? } ?>
<? } ?>
</tr>
<?
}
?>
</table></td>
</tr>
<? } ?>
<? } else { ?>
<? } ?>
</table>
$mPageSize = @$HTTP_POST_VARS["txtPageSize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
{
$mPageSize = @$HTTP_GET_VARS["pagesize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
$mPageSize = 3;
}
I'll post the loop below next, but whats happening is that it is displaying 3 in a row, but for some reason it goes the extra 1 which creates another but empty hotel, and so creating a new row beneath the 1st row which is pushing my footer down. Can anybody help:
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
<?php
if(!$mRecordCount == 0) {
?>
<?php } ?>
<tr>
<td> </td>
</tr>
<?
if($records>0)
{
$cnt=$records+(3-$records%3);
$i=1;
for($i=1;$i<$cnt;$i++) { ?>
<tr>
<td><table border="0" align="left" cellpadding="0" cellspacing="0" width="98%" >
<?
if(($i%3)==0 || $i==1 ){ ?>
<tr>
<? for($j=1;$j<=3;$j++) {
$morevalue=true;
$rows=mysql_fetch_assoc($result) or $morevalue=false;
?>
<td width="<? if($j==1) { print("228"); } else { print("242"); } ?>" align="left" valign="top"><table width="217" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="middle"><table width="201" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="62" height="63" align="left" valign="top">
<? if($morevalue){
if(is_file("../admin1212/".$rows['foto1']))
{
imgresize("../admin1212/$rows[foto1]");
?> <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>" class="bodySmall1"><img src="../admin1212<?=$rows['foto1']?>" alt="" height="80" width="80" border="0"/></a>
<? }} ?> </td>
<td width="7"> </td>
<td width="132" align="left" valign="top"><span class="bahia">
</span><span class="bahia">
<? if($morevalue){ ?>
<?=$rows['hotel_name']?>
<? } ?>
</span><br>
<? if($morevalue){ ?>
<?php $int=strlen($rows['star_rating']);
if($int>0) { $k=0; while($k<$int) { ?>
<img src='images/star.gif' border='0' alt="" />
<?php $k++; } } ?>
<? } ?>
<br> <span class="maxico">
<? if($morevalue){ ?>
<?=$rows['country']?>
<? } ?>
</span><br>
<span class="bodySmall1">
<? if($morevalue){ ?>
<a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>" class="bodySmall1">More Info</a>
<? } ?>
</span></td>
</tr>
</table></td>
</tr>
if($morevalue){ ?>
<tr>
<td height="1" align="left" valign="top" bgcolor="#CCCCCC"></td>
</tr>
<? } ?>
</table></td>
</tr>
</table></td>
<? if(($j==1||$j==2) && $morevalue) { ?>
<td width="1" bgcolor="#CCCCCC"></td>
<? } ?>
<? } ?>
</tr>
<?
}
?>
</table></td>
</tr>
<? } ?>
<? } else { ?>
<? } ?>
</table>