Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Restaurant's reservation system [functions]

    Heelloo...I'm currently doing the restaurant's reservation system. I wanna do this function. The function i needed is when the date arrival of guest is more than the actual server time, a label called "reservation cancelled" will be show to inform to the user that the reservation is cancelled by looking at the label.

    Maybe..I am not good in explaning. I will give u d example: a customer key in the time arrival as 12.30pm and date as 1/3/2007 for his reservation, but when the customer do not show up within 30mins after the arrival time (means 1pm), the label called "reservation cancelled" will be shown to tell the staff that the reservation is cancelled! If there are functions that can auto delete the records that over the arrival time, it is good!! And can anyone help me to create the fucntion of for deleting the records using the checkbox! Can anyone help me to improve it? Thanks! The following is the code i done:

    PHP Code:
    <?php 

    $result 
    mysql_query("SELECT * FROM reservation WHERE username = '" $_SESSION['user_logged'] . "' "); 

    echo 
    "<b><center><table border='0' border='black' padding='20' cellspacing='10' bgcolor='#FFCCCC'></font></b></center> 
    <tr> 
    <th align='left'>  </th> 
    <th align='left'>Reservation No.</th> 
    <th align='left'>Date</th> 
    <th align='left'>Time</th> 
    <th align='left'>Number Of Guests</th> 
    </tr>"


    while(
    $row mysql_fetch_array($result)) 
      { 
      echo 
    "<tr>"
      echo 
    "<td>" "<INPUT TYPE='checkbox'  NAME='to_del[]' VALUE=1 checked>"
      echo 
    "<td>" "<left>" $row['reservationID'] . "</td>"
      echo 
    "<td>" "<left>" $row['date'] . "</td>"
      echo 
    "<td>" "<left>"$row['time'] . "</td>"
      echo 
    "<td>" "<center>" $row['numberOfGuest'] . "</td>"
      echo 
    "<td>" "<font color='red'><label for='male'> RESERVATION CANCELLED</label></font>"
      echo 
    "</tr>"
      } 
        
    echo 
    "</table>"
    echo 
    "<br><INPUT TYPE='submit' NAME='submit' VALUE='Delete'>"
    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    I would recommend against deleting reservations right away-- if someone shows up 35 minutes late, it's much better for the hostess to be able to see the record in the system with the original time on there and say "Oh I'm sorry, your reservation was given to someone else because you were so late" instead of the hostess not seeing anything in the system and saying "Gee I don't see a reservation under that name" and then the guy goes on a rampage about how he made the reservation, how could you not have the reservation, where did it go, what kind of place are you running here, let me talk to your supervisor, I'll never come here again, you know, the usual.

    As for the issue of checking reservation times, look into MySQL's date/time functions.

  • #3
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    check the ' Delete item with checkbox post ' or search it on Quick search

  • #4
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator View Post
    I would recommend against deleting reservations right away-- if someone shows up 35 minutes late, it's much better for the hostess to be able to see the record in the system with the original time on there and say "Oh I'm sorry, your reservation was given to someone else because you were so late" instead of the hostess not seeing anything in the system and saying "Gee I don't see a reservation under that name" and then the guy goes on a rampage about how he made the reservation, how could you not have the reservation, where did it go, what kind of place are you running here, let me talk to your supervisor, I'll never come here again, you know, the usual.

    As for the issue of checking reservation times, look into MySQL's date/time functions.
    ya...something like tat..but i do not know how to do such functions...can pls help me by giving me some source code? thanks!

  • #5
    New Coder
    Join Date
    Jul 2005
    Location
    Northfield, MA
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It seems like you just need to compare two different times, right? This may not be the best way to do it (it's 3:30am, cut me a little slack) but perhaps you could convert both times to an integer to make them easy to compare (that is, unless PHP doesn't have a function for comparing times). Also, it might be useful to add another column to your MySQL table pertaining to the reservation's staus (active, canceled, etc etc). Hope that helps a little
    I'm not always the most helpful, but I'm trying :P

  • #6
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Read through the link I provided and if you have any specific questions concerning the material on that page, feel free to ask.

    I'm happy to help out, but only if you demonstrate you're willing to put effort into it yourself.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •