Create("churchil_demo"); /* If we've got any data handed in via CGI, then add the * new Auction to the database. Do some error checking * first though. Just in case, ya know? */ if ($newlist != "") { /* First check to make sure the user has included all * of the required variables. If not, gripe about it * and return them a page with the existing info filled * out already. */ $error = 0; $error += RequiredVar("Name",$Name); $error += RequiredVar("Auctioneer",$Auctioneer); $error += RequiredVar("Location",$Location); $error += RequiredVar("CatList",$CatList); if ($error == 0) { /* Ok, we've got valid data. Insert the Auction listing * into the Auctions table. */ $viewtime = $ViewTime_year."-".$ViewTime_month."-".$ViewTime_day ." " . $ViewTime_hr.":".$ViewTime_min.":00"; $starttime = $StartTime_year."-".$StartTime_month."-".$StartTime_day . " " . $StartTime_hr.":".$StartTime_min.":00"; $insert = "insert into Auctions values(0, '" . AddSlashes($Name) . "', '$viewtime', '$starttime', '" . AddSlashes($BuyersFee) . "', '" . AddSlashes($EnterFee) ."', $Auctioneer, $Location)"; $sql->Insert($insert); /* Also update the state number count */ $state = $sql->QueryItem("select State from Locations where ID = $Location"); $num = $sql->QueryItem("select Num from States where Abrev = '$state'"); $num++; $sql->Update("update States set Num = $num where Abrev = '$state'"); /* Now insert this new auction and it's catagories * into the Xref table. Also increment the count in the * CatagoryList for each catagory type. */ $id = $sql->QueryItem("select max(ID) from Auctions"); $cat = current($CatList); do { $sql->Insert("insert into Auction_Catagory_Xref values($id, $cat)"); $num = $sql->QueryItem("select Num from CatagoryList where ID = $cat") + 1; $sql->Update("update CatagoryList set Num = $num where ID = $cat"); } while ($cat = next($CatList)); /* Print out a nice message to let the user know what's happened */ echo("
\n"); echo("

Created new Auction Listing: $Name\n"); echo("

\n"); echo("


\n"); } } ?>
Add a New Auction Listing
Auction Name
When are the items open for Viewing?

Note, times are in military format.
i.e. 3:00pm is 15:00

\n"); SelectTime("ViewTime",""); ?>
When does the auction begin? \n"); SelectTime("StartTime",""); ?>
Buyers Fee
Entrance Fee
Who is the Auctioneer?
Auction Location:
Auction Catagories

(Multiple selections allowed)