Jump to content

want add count rooms.Right now this code is good if hotel has 2 rooms but if hotel has 20 rooms no good.


Nemanja

Recommended Posts

 

want add count rooms.Right now this code is good if hotel has 2 rooms but if hotel has 20 rooms no good.

Here is my code

<!-- language: lang-php -->

$query = "select dates, rooms, COUNT(dates) FROM calendar3 group by dates, dateto, rooms order by dates, rooms";


$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result))
{
if($row['COUNT(dates)'] > 2 ){
echo '
<font color="#FF4040">'."<br />"."Date ".$row['datefrom']." for this type of rooms is not available". "<br />"."Select another date or room." ;
}
elseif ($row['COUNT(datefrom)'] <= 2 ) {
echo '
<font color="#00CC00">'."The rooms are available!"."<br />";

"
<br />";


<!-- end snippet -->

$query = "select dates, rooms, COUNT(dates) FROM calendar3 group by dates, dateto, rooms order by datefrom, rooms";


$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result))
{
if($row['COUNT(dates)'] > 2 ){
echo '
<font color="#FF4040">'."<br />"."Date ".$row['dates']." for this type of rooms is not available". "<br />"."Select another date or room." ;
}
elseif ($row['COUNT(dates)'] <= 2 ) {
echo '
<font color="#00CC00">'."The rooms are available!"."<br />";

"
<br />";

 

in this code

 

if($row['COUNT(dates)'] > 2 ){

is the "2" the 2 rooms you mentioned?

 

If that is the case then your code isn't good even for 2 rooms.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.