从数据库中删除/删除id,start,end,body

时间:2013-11-20 13:19:21

标签: php jquery mysql database

save : function() {

                  calEvent.start = new Date(startField.val());
                  calEvent.end = new Date(endField.val());
                  calEvent.title = titleField.val();
                  calEvent.body = bodyField.val();

                  $calendar.weekCalendar("updateEvent", calEvent);
                  $dialogContent.dialog("close");
               },
               "delete" : function() {
                  $calendar.weekCalendar("removeEvent", calEvent.id);
                  $dialogContent.dialog("close");
               },
               cancel : function() {
                  $dialogContent.dialog("close");
               }
            }
         }).show();

我现在在JS请求中添加了save.atp

$.post("events.php?action=save&start="+calEvent.start.getTime()/1000+"&end="+calEvent.end.getTime()/1000+"&title="+calEvent.title+"&body="+calEvent.body);

AND通过data : "events.php"输出

保存现在正在运行,使用events.php调用它

if($action == 'save')
{
    $title = $_REQUEST['title'];
    $body = $_REQUEST['body'];
    $start_time = (int)$_REQUEST['start'];
    $start_time = $start_time - 60*60;
    $end_time = (int)$_REQUEST['end'];
    $end_time = $end_time - 60*60;
    $start = date('c',$start_time);
    $end = date('c',$end_time);
    $sql = "INSERT INTO meeting_rooms_calendar(title,body,start,end) VALUES ('$title','$body','$start','$end')";
    $result = mysql_query($sql, $link);
}
else
{
    $sql= "SELECT id, title, body, 
            DATE_FORMAT(start, '%Y-%m-%dT%H:%i' ) AS startTime, DATE_FORMAT(end, '%Y-%m-%dT%H:%i' ) AS endTime
           FROM meeting_rooms_calendar
           ORDER BY start DESC";

仍然无法弄清楚如何删除表ID,开始,结束,正文 我试图放入events.php

if(action == 'delete'){
$del_sql = "INSERT INTO meeting_rooms_calendar(title,body,start,end) VALUES ('$title','$body','$start','$end')";

$del_sql;


}

0 个答案:

没有答案