Fix the code
Posted: Wed Apr 22, 2015 8:34 pm
this code is not working anyone can fix it
Code: Select all
$maxRooms1 =6;
$maxRooms2 =5;
$maxRooms3 = 5;
$fetchQuery = "SELECT datefrom, rooms, COUNT( datefrom ) , COUNT( rooms )
FROM calendar3
GROUP BY rooms, datefrom ";
$fetchResult = mysql_query($fetchQuery);
$numberRooms = mysql_num_rows($fetchResult);
if ($numberRooms >= $maxRooms1) {
echo "</br>"."The beds are not available!!";
} elseif ($numberRooms < $maxRooms1) {
echo "</br>"."1 The beds are available! !";
}
if ($numberRooms >= $maxRooms2) {
echo "</br>". "rooms two beds are not available!!";
} elseif ($numberRooms < $maxRooms2) {
echo "</br>". "2 ima !";
}
if ($numberRooms >= $maxRooms3) {
echo "</br>". "3 not available!";
} elseif ($numberRooms < $maxRooms3) {
echo "</br>". "3 rooms beds are available! !";
}
$maxRooms1 =6;
$maxRooms2 =5;
$maxRooms3 = 5;
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result))
{
if($row['COUNT(datefrom)'] <= $maxRooms1){
echo '<font color="#FF4040">'."<br />"."Date ".$row['datefrom']." for one bed is not available". "<br />"."Select another date or room." ;
}
elseif ($row['COUNT(datefrom)'] >$maxRooms1) {
echo '<font color="#00CC00">'."The rooms one beds are available!"."<br />";
"<br />";
}
}
if($row['COUNT(datefrom)'] <= $maxRooms2){
echo '<font color="#FF4040">'."<br />"."Date ".$row['datefrom']." for two beds is not available". "<br />"."Select another date or room." ;
}
elseif ($row['COUNT(datefrom)'] > $maxRooms2){ {
echo "</br>".'<font color="#00CC00">'."The rooms two beds are available!"."<br />";
"<br />";
}
if($row['COUNT(datefrom)'] <= $maxRooms3){
echo '<font color="#FF4040">'."<br />"."Date ".$row['datefrom']." for three beds is not available". "<br />"."Select another date or room." ;
}
elseif ($row['COUNT(datefrom)'] > $maxRooms3){ {
echo '<font color="#00CC00">'."The rooms three beds are available!"."<br />";
"<br />";
}
}
}