Jump to content

Recommended Posts

Hi folks, been away for a bit, and forgotten some things, anyhow, can you pls help.  I have 2 tables in a DB, one contains a list of "rooms' the other is for room availability. - based on date.

All I want to do is find out which rooms are available on certain dates. e.g:

$sql = "SELECT * FROM roomlist
  LEFT JOIN roomavailability ON roomavailability.roomlistID=roomlist.roomlistID
  WHERE roomavailability.datefrom BETWEEN $adate AND $departdate
  AND roomavailability.dateto BETWEEN $adate AND $departdate";
  $rs  = mysql_query($sql) or die("Error: " . mysql_error());
  while ($row = mysql_fetch_array($rs, MYSQL_ASSOC))
  {
  echo  $row['roomlistID'];
  }

This query gives me the right results for rooms that have been booked, but  what I actually want is roomlistID from roomlist if it is not in the above query.  understand?

Help much appreciated, thanks
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.