Guest User

Untitled

a guest
Mar 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. if(isset($_POST["getresourceno"],$_POST["getstudentno"],$_POST["getresourcetitle"],$_POST["getusertype"],$_POST["whatprocess"]) && $_POST["whatprocess"] == "listresource"){
  2.  
  3. $getresourceno = htmlspecialchars(strip_tags($_POST["getresourceno"]));
  4. $getstudentno = htmlspecialchars(strip_tags($_POST["getstudentno"]));
  5. $getresourcetitle = htmlspecialchars(strip_tags($_POST["getresourcetitle"]));
  6. $getusertype = htmlspecialchars(strip_tags($_POST["getusertype"]));
  7. $borrowcount = "1";
  8.  
  9. $checkquery = "SELECT bi.user_type_id , bi.user_school_verification_id , bi.resource_no , bi.resource_title , bi.quantity , SUM(bi.borrow_count_issuance) , ut.borrow_count FROM tbl_borrow_issuance as bi JOIN tbl_user_type as ut on bi.user_type_id = ut.user_type_id WHERE bi.user_type_id = ? AND bi.user_school_verification_id = ?";
  10.  
  11. $stmt1 = $mysqlconnection->prepare($checkquery);
  12. $stmt1->bind_param("ss",$getusertype, $getstudentno );
  13. $stmt1->execute();
  14. $stmt1->store_result();
  15. $stmt1->bind_result($user_type_id, $user_school_verification_id, $resource_no, $resource_title, $quantity , $borrow_count_issuance ,$borrow_count);
  16.  
  17. if($stmt1->num_rows > 0){
  18.  
  19. while ($stmt1->fetch())
  20. {
  21. $borrow_count_issuance = $borrow_count_issuance;
  22.  
  23. if ($getusertype == 1 && $borrow_count_issuance > 3)
  24. {
  25.  
  26. $query = "INSERT INTO tbl_borrow_issuance (user_type_id , user_school_verification_id, resource_no , resource_title , borrow_count_issuance ) VALUES (? , ? , ? ,? , ?)";
  27. $stmt = $mysqlconnection->prepare($query);
  28. $stmt->bind_param("sssss",$getusertype, $getresourceno, $getstudentno , $getresourcetitle ,$borrowcount );
  29. if($stmt->execute()){
  30.  
  31. echo "SUCCESS";
  32.  
  33. }else
  34. {
  35.  
  36. echo "ERROR3";
  37. }
  38. }
  39. else
  40. {
  41.  
  42. echo "ERROR2";
  43. }
  44. }
  45.  
  46. }
  47. else
  48. {
  49. echo "ERROR1";
  50. }
  51.  
  52.  
  53. }//end of if statement
Add Comment
Please, Sign In to add comment