require("include/top.php");
unset($submitok);
if(!$which)
$errormessage[] = "no prod selected o_O";
// check the submitted data
if($party || $pyear || $prank || ($ryear))
{
// check user account
if(!isset($_SESSION['SESSION']))
$errormessage[]="you need to be logged in first.";
// check if this prod exists
$query = "SELECT count(0) FROM prods WHERE id=".$which;
$result = mysql_query($query);
if(!mysql_result($result,0))
$errormessage[] = "I can't find this prod o_O";
// if everything is ok
if(!$errormessage)
$submitok=true;
}
// update the prod with the submitted info
if($submitok){
$query = "UPDATE prods SET ";
if(($rmonth)&&($ryear)) {
$query.= "date='".$ryear."-".$rmonth."-15', ";
} else {
if($ryear) {
$query.= "date='".$ryear."-00-15', ";
}
}
if($party) {
$query.= "party=".$party.", ";
} else {
$query.= "party=0, ";
}
if($pyear) {
$party_year=intval($pyear);
$query.= "party_year=".$party_year.", ";
} else {
$query.= "party_year=NULL, ";
}
if($compo) {
$query.= "partycompo=\"".$compo."\", ";
} else {
$query.= "partycompo=NULL, ";
}
if($prank) {
$query.= "party_place=".$prank." ";
} else {
$query.= "party_place=NULL ";
}
$query.='WHERE id='.$which.' LIMIT 1';
mysql_query($query);
}
$result = mysql_query("DESC prods partycompo");
$row = mysql_fetch_row($result);
$compos = explode("'",$row[1]);
?>