Current location: Hot Scripts Forums » Programming Languages » PHP » data base task


data base task

Reply
  #1 (permalink)  
Old 12-21-08, 06:59 AM
john_zakaria john_zakaria is offline
Newbie Coder
 
Join Date: Nov 2008
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
data base task

room_type
rooms_no
persons
checkin
checkout

3 2 1 0000-00-00 0000-00-00
6 3 4 2008-11-14 0000-00-00
6 3 4 2008-11-14 0000-00-00
4 4 5 2008-11-14 2008-11-18

Now I have this table and I want to make SQL STATEMENT to make the following task

To see if the user can make a reservation in a hotel during the checkin and checkout date, by checking the numbers of rooms available in each room type during the checkin and checkout period of time
For example if the user enter number of persons that exceed the person that exists already in the database
And also to check if this period of time is available to make reservation according the the persons number


Note : rooms-type in this example are (3,6,6,4)
room_no in this example are (2,3,3,4)
person (1,4,4,5) -> number of persons
Attached Images
File Type: jpg Untitled-1.jpg (46.7 KB, 41 views)

Last edited by john_zakaria; 12-21-08 at 07:05 AM.
Reply With Quote
  #2 (permalink)  
Old 12-21-08, 04:23 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
is row 2 and 3 a mistake as it seems it's a duplicate, if this is what your after stopping then it should be done in the php not the SQL as validating your data before writing it will always be the best programming ethic.
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #3 (permalink)  
Old 12-22-08, 12:07 AM
john_zakaria john_zakaria is offline
Newbie Coder
 
Join Date: Nov 2008
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
do u mean that i have to do it using php not MYSQL?


row 2 and row 3 have no mistakes coz this is a trial to insert in database not to make this task
but i've attached this picture to let you see the table
Reply With Quote
  #4 (permalink)  
Old 12-22-08, 12:11 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL is a database where you keep data, all of the cleaver handling and data manipulation comes from the code, in this case php.
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data base display Andy128 PHP 4 06-09-07 06:52 PM
Form data to data base boxkites Script Requests 0 05-02-06 02:56 AM
Pushing data to clients brokennb PHP 2 06-16-05 08:52 PM


All times are GMT -5. The time now is 08:25 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.