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.


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.