AJAX Calendar Admin
New Event
"; $time = $_POST['date']." ".$_POST['hour'].":".$_POST['min'].":00"; if($sf == 'save') { $query = "INSERT INTO `events` (`date`,`heading`,`body`) VALUES ('".$time."','".$_POST['heading']."','".$_POST['event']."')"; mysql_query($query); if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error().""; if($err!='') { echo " Sorry, a database error occured.
".$err; } else { echo " The event was stored successfully"; } } else if($sf == 'list') { ?> } } else if($f == 'edit') { echo "
Edit / Delete Event
"; if($sf == 'list') { $query = "SELECT `num`,`heading`,DATE_FORMAT(`date`,'%m-%d-%Y') as `fdate` FROM `events` ORDER BY `date` DESC"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $evtlist .= ""; } ?> } else if($sf == 'show') { $query = "SELECT `num`,`heading`,`body`,DATE_FORMAT(`date`,'%Y-%m-%d') as `date`,DATE_FORMAT(`date`,'%H') as `hour`,DATE_FORMAT(`date`,'%i') as `min` FROM `events` WHERE `num`=".$_POST['num']." LIMIT 1"; $result = mysql_query($query); $row = mysql_fetch_array($result); ?> } else if($sf == 'save') { $time = $_POST['date']." ".$_POST['hour'].":".$_POST['min'].":00"; $query = "UPDATE `events` SET `date`='".$time."',`heading`='".$_POST['heading']."',`body`='".$_POST['event']."' WHERE `num`=".$_POST['num']; mysql_query($query); if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error().""; if($err!='') { echo " Sorry, a database error occured.
".$err; } else { $status = ($cur>0)? "currently active.":"not currently active."; echo " The event was updated successfully."; } } } else if($f == 'delete') { mysql_query("DELETE FROM `events` WHERE `num`=".$_GET['num']); if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error()."
"; if($err!='') { echo " Sorry, a database error occured.
".$err; } else { echo " The event was deleted successfully."; } } ?>