hi there
i have been trying to figure this one out for hours but no hope
basicly this code adds the input from a form to the drama departments DB, then checks the total number of tickets that have been booked
the db input code is fine, its the total number code i cant get to work
the code SHOULD go through the table and find all the rows containing the selected performance name (Test1 for example) in the performance colum
then all the rows containing test1, the "tickets" colum will be added uthen it will be echoed out
heres my code:
<?php
$Performancename = $_POST['Performance'];
mysql_connect("localhost","dncwd_drama","*********");
mysql_select_db("dncwd_drama");
$sql="INSERT INTO bookings (Performance, Name, Email, Phone, Tickets)
VALUES
('$_POST[Performance]','$_POST[Name]','$_POST[Email]','$_POST[Phone]','$_POST[Tickets]')";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
else echo " <br> Tickets Reserved ! <br> you should recive a conformation email shortly, please print it and bring it with you <br>";
$query = "SELECT SUM(Tickets) FROM bookings WHERE Performance = '$Performancename'";
$result = mysql_query($query) or die(mysql_error());
// Print out result
$tot = mysql_fetch_array($result);
echo "Bookings = $tot";
echo "<br>";
?>
the problem is the output of the page is:
thanks for all help guys
[attachment deleted by admin]