...

View Full Version : Restaurant's reservation system [functions]



aywen
03-12-2007, 05:37 PM
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

$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'>";
?>

Fumigator
03-12-2007, 06:17 PM
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 (http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html).

the-dream
03-12-2007, 06:18 PM
check the ' Delete item with checkbox post ' or search it on Quick search

aywen
03-13-2007, 06:35 AM
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 (http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html).

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!

lobsterninja
03-13-2007, 08:37 AM
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 :thumbsup:

Fumigator
03-13-2007, 09:35 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum