my_course_update.php 995 B

1234567891011121314151617181920212223242526
  1. <?php
  2. require_once "../path.php";
  3. require_once "../public/_pdo.php";
  4. require_once '../public/function.php';
  5. global $PDO;
  6. PDO_Connect("sqlite:"._FILE_DB_COURSE_);
  7. $query="UPDATE course SET title = ? , subtitle = ? , summary = ? , teacher = ? , tag = ? , lang = ? , attachment = ? , receive_time = ? , modify_time = ? where id = ? ";
  8. $sth = $PDO->prepare($query);
  9. $sth->execute(array( $_POST["title"] , $_POST["subtitle"] , $_POST["summary"] , $_POST["teacher"] , $_POST["tag"] , $_POST["lang"] , $_POST["attachment"] , mTime() , mTime() , $_POST["course"]));
  10. $respond=array("status"=>0,"message"=>"");
  11. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  12. $error = PDO_ErrorInfo();
  13. $respond['status']=1;
  14. $respond['message']=$error[2];
  15. echo "<div style=''>Course 数据修改失败:{$error[2]}</div>";
  16. }
  17. else{
  18. $respond['status']=0;
  19. $respond['message']="成功";
  20. echo "<div style=''>Course 数据修改成功</div>";
  21. }
  22. //echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  23. ?>