Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST["getresourceno"],$_POST["getstudentno"],$_POST["getresourcetitle"],$_POST["getusertype"],$_POST["whatprocess"]) && $_POST["whatprocess"] == "listresource"){
- $getresourceno = htmlspecialchars(strip_tags($_POST["getresourceno"]));
- $getstudentno = htmlspecialchars(strip_tags($_POST["getstudentno"]));
- $getresourcetitle = htmlspecialchars(strip_tags($_POST["getresourcetitle"]));
- $getusertype = htmlspecialchars(strip_tags($_POST["getusertype"]));
- $borrowcount = "1";
- $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 = ?";
- $stmt1 = $mysqlconnection->prepare($checkquery);
- $stmt1->bind_param("ss",$getusertype, $getstudentno );
- $stmt1->execute();
- $stmt1->store_result();
- $stmt1->bind_result($user_type_id, $user_school_verification_id, $resource_no, $resource_title, $quantity , $borrow_count_issuance ,$borrow_count);
- if($stmt1->num_rows > 0){
- while ($stmt1->fetch())
- {
- $borrow_count_issuance = $borrow_count_issuance;
- if ($getusertype == 1 && $borrow_count_issuance > 3)
- {
- $query = "INSERT INTO tbl_borrow_issuance (user_type_id , user_school_verification_id, resource_no , resource_title , borrow_count_issuance ) VALUES (? , ? , ? ,? , ?)";
- $stmt = $mysqlconnection->prepare($query);
- $stmt->bind_param("sssss",$getusertype, $getresourceno, $getstudentno , $getresourcetitle ,$borrowcount );
- if($stmt->execute()){
- echo "SUCCESS";
- }else
- {
- echo "ERROR3";
- }
- }
- else
- {
- echo "ERROR2";
- }
- }
- }
- else
- {
- echo "ERROR1";
- }
- }//end of if statement
Add Comment
Please, Sign In to add comment