displaying record

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
namitjung
Forum Commoner
Posts: 42
Joined: Mon Jun 20, 2005 3:17 am

displaying record

Post by namitjung »

Hi all,

I got problem to display the records in the browser.My table design is as follows:


table Name:

hotel

hotelid hotelname
1 A
2 B
3 C
4 D


Roomtype

roomtypeid hotelid rommtypetitle normalrate
1 1 Room A 40
2 1 Room B 30
3 1 Room c 20
4 1 Room D 25
5 2 Room E 50
6 2 Room F 55

Discountrates
rateid roomtypeid HotleId startdate enddate discountrate
1 1 1 2006/02/03 2006/02/06 38
2 1 1 2006/02/08 2006/07/09 39
3 1 1 2006/02/15 2006/07/10 40


I Am creating hotel site.All hotel details are stored in hotel table and Roomtypes and it's normal rate of each hotel is stored in roomtype table.Since some hotel may decrease their rates in weekends or in some special occasions those rates (If any) are stored in the discountrates table.Now i have problem for displaying the discounted rates.

In home page there will be a search in which checkin date and checkout date would be selected.After that by using checkedin date and checkedout date it should show the records in this format:

let's suppose check in date is 2006/02/05 and check out date is 2006/02/10


Roomtypetitle 2006/02/05 2006/02/06 2006/02/07 2006/02/08 2006/02/09 2006/02/10

Room A 38 38 40 39 39 40
Room B 30 30 30 30 30 30



Since rate for the 2006/02/05 and 2006/02/06 is exists in discount rates table it would show discountrates.There is no rate for 2006/02/07,so it will show the normal rate stored in roomtype table.Same thing will happen for the rest of the dates.If there is no rates
in discountrate table normal rate would be use.

What kind of query i should use?

Please help me out

Thank You
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Double posting is a no-no.
Locked