coop_post.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. //查询term字典
  3. require_once "../path.php";
  4. require_once "../public/_pdo.php";
  5. require_once '../public/function.php';
  6. require_once '../ucenter/function.php';
  7. require_once '../group/function.php';
  8. $respond['status']=0;
  9. $respond['message']="成功";
  10. if(isset($_POST["res_id"])){
  11. PDO_Connect(_FILE_DB_USER_SHARE_);
  12. $query = "UPDATE share_cooperator set power = ? WHERE res_id=? and cooperator_id = ? ";
  13. $sth = $PDO->prepare($query);
  14. if($sth)
  15. {
  16. # code...
  17. $sth->execute(array($_POST["power"],
  18. $_POST["res_id"],
  19. $_POST["user_id"]
  20. ));
  21. if (!$sth || ($sth && $sth->errorCode() != 0)) {
  22. /* 识别错误 */
  23. $error = PDO_ErrorInfo();
  24. $respond['status']=1;
  25. $respond['message']=$error[2];
  26. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  27. exit;
  28. }
  29. else{
  30. $respond['status']=0;
  31. $respond['message']="成功";
  32. }
  33. }
  34. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  35. }
  36. else{
  37. $respond['status']=1;
  38. $respond['message']="no res id";
  39. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  40. }
  41. ?>