...I'm having an awful finishing this project.
First of all, I'm brand new to php and mysql for the most part and so far we have setup a mysql table that is working properly with inserting, updating and deleting records from web forms.....the problem is that there is a need to do a limit check on the insertform.php file that will make sure that no more than 25 reservations have been made for that date and time BEFORE allowing the INSERT to take place. Here's what I have so far.....
<?
$resdate = $POST['resdate'];
$tourdate = $POST['tourdate'];
$fname = $POST['fname'];
$lname = $POST['lname'];
$address = $POST['address'];
$city = $POST['city'];
$st = $POST['st'];
$zip = $POST['zip'];
$phone = $POST['phone'];
$altphone = $POST['altphone'];
$email = $POST['email'];
$howheard = $POST['howheard'];
$tix = $POST['tix'];
$cc = $POST['cc'];
$ccexp = $POST['ccexp'];
$mailtype = $POST['mailtype'];
// script to display all the records in a table
include('conn.php');
$query = "select SUM(tix) FROM table WHERE tourdate='$tourdate'";
$result = mysql_query($query);
num_tix = $result;
if($num_tix > 25)
{
echo "There are no reservations available for this tour date and time.";
}
elseif($num_tix+$tix > 25)
{
echo "You have entered too many reservations for this tour.";
}
else
{
// Insert Data into table
$query = "INSERT INTO haunted (resdate, tourdate, fname, lname, address, city, st, zip, phone, altphone, email, howheard, tix, cc, ccexp, mailtype) VALUES ('$resdate', '$tourdate', '$fname', '$lname', '$address', '$city', '$st', '$zip', '$phone', '$altphone', '$email', '$howheard', '$tix', '$cc', '$ccexp', '$mailtype')";
$result = mysql_query($query);
// Close the database connection
mysql_close();
echo "Your reservation has been submitted to the database.<br /><br />Click <a href='display.php'>here</a> to review your additions.";
}
?>
Any ideas? I'd really appreciate ANY help you can give. The only that seems to be happening is the execution of the INSERT......
and I can still update and delete records correctly.
Thanks in advance,
Chris