<?php
 
require('../headers.php');
/* if (isset($_POST['owniD'])) {
 $post=$_POST['post'];	   
 $owniD=$_POST['owniD'];
 if ($post=="Set as profile image") {
 	$profile=$_POST['profile'];
 	$scon->updateProfileImage($itemid,$shopid,$profile);
 }*/
 ?>
<center><table border="0" width="95%" style="padding-top:2%;">
	<tr><td colspan="2" height="150px" align ="center"><b><small>HOUSES WITH FREE ROOMS AVAILABLE COMING SOON</small><p/><p/></td></tr>
<?php
$FR=$hcon->checkIfHousesFreeWithExistRoom();
if ($FR->rowCount()>0) {
	 
 
 $hs=$hcon->getOtherHousesOut();
 if ($hs->rowCount()>0) {
  
   $hH=$hs->fetchAll();
   ?>
   <tr>

 <td   valign="top">
		<ul>
   <?php

foreach ($hH as $key => $hD) {


$house_no=$hD['house_no'];

$rD=$hcon->getHousesFreeRoom($house_no);

        if ($rD->rowCount()>0)
         {
   	        $rRD=$rD->fetchAll();
			 

$hMG=$hcon->getHousesPImg($house_no);
if($hMG->rowCount()>0)
             {
               $img=$hMG->fetch();
               $pMG= $img['directory'];
              }
              else
              {
$pMG='../houseimages/defaultP.jpg';
              }


   ?>
  

<li id="dh"> 
		<b> <?php echo $hD['house_title']; ?> </b><br/>
          <img id="emg" src="<?php echo $pMG;?>">
	  
             
					 
                  <form action="../home.php" method="post">

                      

                     <!-- <input class="hi" type="text" name="house_no"  value="<?php //echo $hD['house_no'];?>">-->

 

                      Free rooms<input  id="item" type="submit" value="(<?php echo $rD->rowCount();?>) " name="post"  >

                 </form>
				 
		  
		 
		  
<?php
        
		?>
		 </li>
		
<?php
 }
}
?>
</ul>
		</td>

	</tr>
<?php
}
/*else
{
	?>
	<tr>
		<td colspan="2">
		<p/>No house with free room!..
			
		</td>
	</tr>
	<?php
 
?>
</table>
<?php*/
}
 else
{
	?>
	<tr>
		<td colspan="2">
		<p/>Coming soon!..
			
		</td>
	</tr>
	<?php
 
?>
</table>
</center>
<?php
}
?>
 <?php
require_once('../footers.php');
?> 