samedi 25 avril 2015

code need to be fix it


code need to be fix it my query is working all is good i have diffrent dates,rooms,count datefrom and count rooms in rows but $maxrooms is is not working any suggestions

$maxRooms1 =4;
$maxRooms2 =5;
$maxRooms3 = 5;
        
dates are dates between start and end dates to make clear.

   

   $fetchQuery = " SELECT dates, rooms, COUNT( dates ) , COUNT( rooms ) 
FROM calendar3
GROUP BY rooms, dates";         
    
      
   
   $fetchResult = mysql_query($fetchQuery);
    $count = mysql_num_rows($fetchResult)and $dates = mysql_num_rows($fetchResult);
        
         
         
         if ($row['COUNT(rooms1)'] and $row['COUNT(dates)']   <=  $maxRooms1       ){
    echo "</br>"."1  bed is not available!";
} elseif ($row['COUNT(rooms1)'] and $row['COUNT(dates)']   >  $maxRooms1        ) {
   echo "</br>"."1  bed is  available !";

}
   if ($row['COUNT(rooms2)'] and $row['COUNT(dates)']   <=  $maxRooms2       ){
    echo "</br>"."2  bed is not available!";
} elseif ($row['COUNT(rooms2)'] and $row['COUNT(dates)']   >  $maxRooms2        ) {
   echo "</br>"."2  bed is  available !";

} 
   
       if ($row['COUNT(rooms3)'] and $row['COUNT(dates)']   <=  $maxRooms3       ){
    echo "</br>"."3  bed is not available!";
} elseif ($row['COUNT(rooms3)'] and $row['COUNT(dates)']   >  $maxRooms3        ) {
   echo "</br>"."3  bed is  available !";
} 
    

table structure for table calendar3 -- CREATE TABLE calendar3 ( id int(11) NOT NULL AUTO_INCREMENT, dates date NOT NULL, dateto date NOT NULL, rooms int(11) NOT NULL, KEY id (id) ) ENGINE=InnoDB AUTO_INCREMENT=276 DEFAULT CHARSET=latin1 AUTO_INCREMENT=276 ; -- -- Dumping data for table calendar3 -- INSERT INTO calendar3 VALUES (272, '2015-12-12', '0000-00-00', 1); INSERT INTO calendar3 VALUES (273, '2015-12-13', '0000-00-00', 1); –


Aucun commentaire:

Enregistrer un commentaire