What I am trying to do is if there are no seats available then not to insert anything into the database...
Code: Select all
<?php
if($seat != '0')
{
$sql="INSERT INTO demonstrations (umid, fname, lname, project_title, email, phone, time_slot)
VALUES
('$_POST[umid]','$_POST[fname]','$_POST[lname]','$_POST[project_title]','$_POST[email]','$_POST[phone]','$_POST[time_slot]' )";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
$result = mysql_query("SELECT * from demonstrations");
while($row = mysql_fetch_array($result))
{
echo $row['umid'] . " " . $row['fname'] . " " . $row['lname'] . " " . $row['project_title'] . " " . $row['email'] . " " . $row['phone'] . " " . $row['time_slot'] ;
echo "<br />";
}
mysql__close($con)
}
else
{
mysql__close($con);
}