Jump to content

Ponel

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Ponel

  1. Thanks it worked My Query $sql_referrals_bonus = mysqli_query($con, "select transaction_tbl.amount_deposited, transaction_tbl.userID trans_userID, referal_tbl.userID ref_userID, referal_tbl.referalID ref_referalID from transaction_tbl, referal_tbl where referal_tbl.referalID='$user[id]' and transaction_tbl.userID=referal_tbl.userID GROUP by transaction_tbl.userID"); $result_row_referral = mysqli_num_rows($sql_referrals_bonus); $row_fetch= mysqli_fetch_row($sql_referrals_bonus); if ($result_row_referral>0){ foreach($sql_referrals_bonus as $sub_referral){ $total_bonus += $sub_referral["amount_deposited"]; } $total_bonus = "$".(0.05 * $total_bonus); }else{ $total_bonus = "$"."0".".00"; }
  2. Ok sir. I will check that out and post my output. Thanks 🙏🙏
  3. Good day sirs, Please help me on the challenges I'm facing.. I have two tables "transaction_tbl" and "referal_tbl". What I wanted to do is to check the Transaction_tbl referal_tbl this my code select transaction_tbl.amount_deposited, transaction_tbl.userID trans_userID, referal_tbl.userID ref_userID, referal_tbl.referalID ref_referalID from transaction_tbl, referal_tbl where referal_tbl.referalID='1' and transaction_tbl.userID=referal_tbl.userID GROUP by transaction_tbl.userID My Output I wanted to sum amount_deposited column so i will get 1,240 and get the 5% of 1240 which is 62 My Query $sql_referrals_bonus = mysqli_query($con, "select transaction_tbl.amount_deposited, transaction_tbl.userID trans_userID, referal_tbl.userID ref_userID, referal_tbl.referalID ref_referalID from transaction_tbl, referal_tbl where referal_tbl.referalID='$user[id]' and transaction_tbl.userID=referal_tbl.userID GROUP by transaction_tbl.userID"); $result_row_referral = mysqli_num_rows($sql_referrals_bonus); $row_fetch= mysqli_fetch_row($sql_referrals_bonus); if ($result_row_referral>0){ foreach($sql_referrals_bonus as $sub_referral){ //$total_bonus += $row_fetch[0]; //$total_bonus = $row_fetch[0]; $total_bonus = $sub_referral["amount_deposited"]; $total_bonus = "$".(0.05 * $total_bonus); //$total_bonus = "$".number_format("$total_bonus", 0, '', ',').".00"; } }else{ $total_bonus = "$"."0".".00"; } so i got 30 instead of 62 Note the 30 is the 5% of 600. Please any help on this sirs?
  4. PHP date and time function is not showing correct time on my local system I have the following php code date_default_timezone_set("Africa/Lagos"); $date = date('d-m-y h:i:s'); echo "Server Time ".$date ."<br>"; echo "The time is " . date("h:i:sa")."<br>"; $current_datetime = date("Y-m-d") . ' ' . date("H:i:s", STRTOTIME(date('h:i:sa'))); echo "Current time1: ".$current_datetime . "<br>"; Output Server Time 21-05-21 09:55:39 The time is 09:55:39am Current time1: 2021-05-21 09:55:39 Expected Output Server Time 21-05-21 10:55:39 The time is 10:55:39am Current time1: 2021-05-21 10:55:3 Any help would be appreciated.
  5. Five 🌟 🌟 🌟 🌟 🌟 for Barand
  6. Thank you sir, I'm trying sending multiples email to user using phpmailer first condition////////////////////////////////////******************************************* //First User email $mail = new PHPMailer(TRUE); try { $mail->setFrom('no-reply@me.com', 'Mecom'); $mail->addAddress("$email_firstuser", "$full_name"); $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); $mail->Body = 'Message to first User'; if (!$mail->send()){ echo $mail->ErrorInfo; }else{ echo "sent"; } } catch (Exception $e) { echo $e->errorMessage(); } catch (\Exception $e) { echo $e->getMessage(); } // //End of First User //Second user mail $mail = new PHPMailer(TRUE); try { $mail->setFrom('no-reply@me.com', 'Mecom'); $mail->addAddress("$email_seconduser", "$full_name"); $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); $mail->Body = 'Message to Second User'; if (!$mail->send()){ echo $mail->ErrorInfo; }else{ echo "sent"; } } catch (Exception $e) { echo $e->errorMessage(); } catch (\Exception $e) { echo $e->getMessage(); } // //End of second user mail End of first condition////////////////////////////////////******************************************* Note: I have like four kind of conditions for this Thanks
  7. Good morning, I'm writing a php script on a transaction creation/initiation. Only a registered user can initiate a transaction but if the second party to the transaction is not a registered user, the system will send a mail to the user informing him/her to accept and create an account. The whole idea is i have four conditional statement and each condition needs to send mail to the transaction initiator and the second party. so i am sending 8 mails but 2 at a time if and only if the condition is met. below is my code if ($mode==1){ //echo "Mode 1: ".$mode; $mode2 = 2; $sql = "SELECT * FROM reg WHERE email='$email'"; $query = mysqli_query($con,$sql); $rowreg = mysqli_fetch_row($query); $dbid = $rowreg[0]; $dbemail = $rowreg[1]; if (mysqli_num_rows($query)>0){ /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$email", "$full_name"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear <b>' . $full_name . '</b>;<br/>We believe there is an agreement between you and <b>'. $fullname .' </b>for a transaction. Please see the details of the transaction below</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Mecom'. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ $output ="<div class=\"alert alert-success\">Transaction has been created successfully</div>"; } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } // //End of First User //Second User // $fullname = $user["firstname"] . " " . $user["lastname"]; $full_name = $fname . " ". $lname; /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$dbemail", "$fullname"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear ' . $fullname . ',<br/>You just initiated a transaction with title <b>'. $cat_category .'</b> and description <b> '. $description .' </b>to <b>'. $full_name .' </b>. Below is the details of the transaction</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Mecom'. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ // $output ="<div class=\"alert alert-success\">Transaction has been created successfully</div>"; echo "<script> window.onload = function() { sweetAlert({ title: 'Congratulations', text: 'Your transaction has been created successfully', type: 'success', confirmButtonColor: '#B6EA36' }, function () { window.location.href = './'; }); }; </script>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } // //End of Second User }else{ //if the second user that is not the initiator is not a registered user //Add user info into the database table for the main site table //include ('includes/randStrGen.php'); $reg_no = randStrGen(4); $check_ID_query = mysqli_query($con, "SELECT regNo FROM reg WHERE regNo='$reg_no'"); $i = 0; //if username exists add number to username while(mysqli_num_rows($check_ID_query) != 0) { $i++; //Add 1 to i $reg_no = $reg_no + $i; $check_ID_query = mysqli_query($con, "SELECT regNo FROM reg WHERE regNo='$reg_no'"); } /* echo "First Name ". $fname . "<br>"; echo "Last Name ". $lname . "<br>"; echo "Address ". $address . "<br>"; echo "Phone Number ". $phonenumber . "<br>"; echo "Registration Number ". $reg_gen . "<br>"; exit();*/ $sql_reg = "INSERT INTO reg(email,password,firstname,lastname,marital_status,phone_number,IDmeans,passportID,lastlogin,regNo,address,bank_acct_number,bank_acct_name,bank_name,real_pass,activation,regDate) VALUES('$email','0','$fname','$lname','0','$phonenumber','0','0',now(),'$reg_no','$address','0','0','0','0','0',now())"; $query_reg = mysqli_query($con,$sql_reg); $regid = mysqli_insert_id($con); $sql_reg_verify = "INSERT INTO account_verify(token_email,refno) VALUES('$email','$reg_no')"; $query_reg_verify = mysqli_query($con,$sql_reg_verify); //$regid = mysqli_insert_id($link); $sql_description = "INSERT INTO description(item_description,transactID) VALUES('$description','$transact_no')"; $query_description = mysqli_query($con,$sql_description); $descid = mysqli_insert_id($con); //$r_tran= $_SESSION['transID'] .$descid ; $sql = "INSERT INTO trans_tbl(transact_no,transact_date,agreement_status,mode_transactID,transact_catID,regID,descID,amount,shipcost,status,transaction_period,inspection_length,charges,amt_pay,comp_charges,transaction_link,payment_status,shipment_status,confirm_shipment,address,refno) VALUES('$transact_no',now(),'1','$mode','$cat','$user[id]','$descid','$price','0','0','0','0','$charges','0','$chrg','0','0','0','0','$address','0'), ('$transact_no',now(),'1','$mode2','$cat','$regid','$descid','$price','0','0','0','0','$charges','0','$chrg','0','0','0','0','$address','0')"; $query = mysqli_query($con,$sql); /* Sending mail to new user to update his/her password */ $encode_email = base64_encode(base64_encode($email)); $encode_reg = base64_encode(base64_encode($reg_no)); //$encode_transactiinID = base64_encode(base64_encode($_SESSION['transID'])); //$encode_parnterID = base64_encode(base64_encode($_SESSION['id'])); //$encode_modeID = base64_encode(base64_encode($mode)); $link_url="<a href=\"https://www.safetranzact.com/verify-account?token=$encode_reg\" style=\"text-decoration: none;display: inline-block;background: #00bf6f;color: white;padding: 10px 20px;border-radius: 5px;\">Review and Sign up</a>"; $year = date('Y'); //send email to the receiver //First user for non register // $full_name = $fname . " " . $lname; $fullname = $user["firstname"] . " ". $user["lastname"]; /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$email", "$full_name"); /* Set the subject. */ $mail->Subject = 'Account/Transaction Verification'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear ' . $full_name. ',<br/>We believe there is an agreement between you and <b>'. $fullname .' </b> for a transaction. And we noticed that you have not yet signed up; Please Sign up and see the details of the transaction below</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> <tfoot> <tr> <td colspan="2">'.$link_url.'</td> </tr> </tfoot> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Mecom'. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ $output ="<div class=\"alert alert-success\">Transaction has been created successfully</div>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } // // //End of First user for non register //Second user for register // $full_name = $fname . " " . $lname; $fullname = $user["firstname"] . " ". $user["lastname"]; $year = date('Y'); /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$dbemail", "$fullname"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear ' . $fullname . ',<br/>You just initiated a transaction with title <b>'. $cat_category .'</b> and description <b>'. $description .' </b> to <b>'. $full_name .' </b> Below is the details of the transaction</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Mecom'. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ echo "<script> window.onload = function() { sweetAlert({ title: 'Congratulations', text: 'Your transaction has been created successfully', type: 'success', confirmButtonColor: '#B6EA36' }, function () { window.location.href = './'; }); }; </script>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } //$mail4->ClearAllRecipients(); // //End of Second user for register } }else{ ///////////////////////Second condition with //echo "Mode 2: ".$mode; $mode2 = 1; $sql = "SELECT * FROM reg WHERE email='$email' LIMIT 1"; $query = mysqli_query($con,$sql); $rowreg = mysqli_fetch_row($query); $dbid = $rowreg[0]; $dbemail = $rowreg[1]; if (mysqli_num_rows($query)>0){ //Add user info into the database table for the main site table $sql_description = "INSERT INTO description(item_description,transactID) VALUES('$description','$transact_no')"; $query_description = mysqli_query($con,$sql_description); $desc_id = mysqli_insert_id($con); //$r_tran= $_SESSION['transID'] .$descid ; $sql = "INSERT INTO trans_tbl(transact_no,transact_date,agreement_status,mode_transactID,transact_catID,regID,descID,amount,shipcost,status,transaction_period,inspection_length,charges,amt_pay,comp_charges,transaction_link,payment_status,shipment_status,confirm_shipment,address,refno) VALUES('$transact_no',now(),'1','$mode','$cat','$user[id]','$desc_id','$price','0','0','0','0','$charges','0','$chrg','$tran_link','0','0','0','$address','0'), ('$transact_no',now(),'1','$mode2','$cat','$dbid','$desc_id','$price','0','0','0','0','$charges','0','$chrg','$tran_link','0','0','0','$address','0')"; $query = mysqli_query($con,$sql); //First user to received email // $full_name = $fname . " ". $lname; $fullname = $user["firstname"] . " ". $user["lastname"]; $year = date('Y'); /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$email", "$full_name"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear <b>' . $full_name . '</b>,<br/>We believe there is an agreement between you and <b> '. $fullname .' </b>for a transaction. Please see the details of the transaction below</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Safetranzact '. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ $output ="<div class=\"alert alert-success\">Transaction has been created successfully</div>"; } //$mail->ClearAllRecipients(); } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } //$mail->ClearAllRecipients(); // //End of First user to received email //Second user to received email // $fullname = $user["firstname"] . " " . $user["lastname"]; $full_name = $fname . " " . $lname; $year = date('Y'); /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@safetranzact.com', 'Safetranzact'); /* Add a recipient. */ $mail->addAddress("$dbemail", "$fullname"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear ' . $fullname . ',<br/>You just initiated a transaction with title <b>'. $cat_category .'</b> and description <b>'. $description .' to <b>'. $full_name .' </b>Below is the details of the transaction</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Safetranzact '. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ echo "<script> window.onload = function() { sweetAlert({ title: 'Congratulations', text: 'Your transaction has been created successfully', type: 'success', confirmButtonColor: '#B6EA36' }, function () { window.location.href = './'; }); }; </script>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } //$mail->ClearAllRecipients(); // //End of Second user to received email }else{ //Add user info into the database table for the main site table //include ('includes/randStrGen.php'); $reg_no = randStrGen(4); $check_ID_query = mysqli_query($con, "SELECT regNo FROM reg WHERE regNo='$reg_no'"); $i = 0; //if username exists add number to username while(mysqli_num_rows($check_ID_query) != 0) { $i++; //Add 1 to i $reg_no = $reg_no + $i; $check_ID_query = mysqli_query($con, "SELECT regNo FROM reg WHERE regNo='$reg_no'"); } /* echo "First Name ". $fname . "<br>"; echo "Last Name ". $lname . "<br>"; echo "Address ". $address . "<br>"; echo "Phone Number ". $phonenumber . "<br>"; echo "Registration Number ". $reg_gen . "<br>"; exit();*/ $sql_reg = "INSERT INTO reg(email,password,firstname,lastname,marital_status,phone_number,IDmeans,passportID,lastlogin,regNo,address,bank_acct_number,bank_acct_name,bank_name,real_pass,activation,regDate) VALUES('$email','0','$fname','$lname','0','$phonenumber','0','0',now(),'$reg_no','$address','0','0','0','0','0',now())"; $query_reg = mysqli_query($con,$sql_reg); $regid = mysqli_insert_id($con); $sql_reg_verify = "INSERT INTO account_verify(token_email,refno) VALUES('$email','$reg_no')"; $query_reg_verify = mysqli_query($con,$sql_reg_verify); //$regid = mysqli_insert_id($link); $sql_description = "INSERT INTO description(item_description,transactID) VALUES('$description','$transact_no')"; $query_description = mysqli_query($con,$sql_description); $descid = mysqli_insert_id($con); //$r_tran= $_SESSION['transID'] .$descid ; $sql = "INSERT INTO trans_tbl(transact_no,transact_date,agreement_status,mode_transactID,transact_catID,regID,descID,amount,shipcost,status,transaction_period,inspection_length,charges,amt_pay,comp_charges,transaction_link,payment_status,shipment_status,confirm_shipment,address,refno) VALUES('$transact_no',now(),'1','$mode','$cat','$user[id]','$descid','$price','0','0','0','0','$charges','0','$chrg','0','0','0','0','$address','0'), ('$transact_no',now(),'1','$mode2','$cat','$regid','$descid','$price','0','0','0','0','$charges','0','$chrg','0','0','0','0','$address','0')"; $query = mysqli_query($con,$sql); /* Sending mail to new user to update his/her password */ $encode_email = base64_encode(base64_encode($email)); $encode_reg = base64_encode(base64_encode($reg_no)); //$encode_transactiinID = base64_encode(base64_encode($_SESSION['transID'])); //$encode_parnterID = base64_encode(base64_encode($_SESSION['id'])); //$encode_modeID = base64_encode(base64_encode($mode)); $link_url="<a href=\"https://www.safetranzact.com/verify-account?token=$encode_reg\" style=\"text-decoration: none;display: inline-block;background: #00bf6f;color: white;padding: 10px 20px;border-radius: 5px;\">Review and Sign up</a>"; // echo "<br><div class=\"alert alert-info alert-dismissible\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button><strong>Please check your email to reset your password</strong><br>Congratulations! $email <br>A request has been successful to reset your account password check your mail to reset your password.<br><br>if you are using offline mode, click on the below link to continue<br> //$link_url = "<a href=\"http://localhost/parcel%20tracking/one-pages/accounting/verify-account?token=$encode_email\" target=\"_blank\">Review and Sign up</a>"; //$link_url = "http://localhost/parcel%20tracking/one-pages/accounting/verify-account?token=$encode_email"; //First user non register $full_name = $fname . " " . $lname; $fullname = $user["firstname"] . " ". $user["lastname"]; /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$email", "$full_name"); /* Set the subject. */ $mail->Subject = 'Account/Transaction Verification'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear <b>' . $full_name. ',</b><br/>We believe there is an agreement between you and <b>'. $fullname .'</b> for a transaction. And we noticed that you have not yet signed up; Please Sign up and see the details of the transaction below</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> <tfoot> <tr> <td colspan="2">'.$link_url.'</td> </tr> </tfoot> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Safetranzact '. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ $output ="<div class=\"alert alert-success\">Transaction has been created successfully</div>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } //End of first user non register //Second user register // $fullname = $user["firstname"] . " " . $user["lastname"]; $full_name = $fname . " " . $lname; $year = date('Y'); /* Create a new PHPMailer object. Passing TRUE to the constructor enables exceptions. */ $mail = new PHPMailer(TRUE); /* Open the try/catch block. */ try { /* Set the mail sender. */ $mail->setFrom('no-reply@me.com', 'Mecom'); /* Add a recipient. */ $mail->addAddress("$dbemail", "$fullname"); /* Set the subject. */ $mail->Subject = 'Transaction Created Successfully'; $mail->isHTML(TRUE); /* Set the mail message body. */ $mail->Body = '<div class="email-background" style="background: #eee;padding: 10px;"> <a href=""><center><img src="" style="padding-top:30px;padding-bottom:30px;max-width:100px;height:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 12px;font-weight: 300;color: #666;line-height: 1.5;text-align:left"> Dear ' . $fullname . ',<br/>You just initiated a transaction with title <b>'. $cat_category .'</b> and description <b>'. $description .' to <b>'. $full_name .'</b> Below is the details of the transaction</p> <div class="table table-responsive" style="margin-left: 10px;margin-right: 10px;"> <table class="table table-striped table-bordered" style="max-width: 100%;background-color: transparent;border-collapse: collapse;border-spacing: 0;display: table;width: 100%;margin-bottom: 20px;border: 1px solid #ddd;"> <tbody style="display: table-row-group;vertical-align: middle;border-color: inherit;"> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="2" width="100%" style="text-align: center;background: #00bf6f;color: white;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;font-size:20px">Transaction Details <b>'.$transact_no.'</b></td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Title</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$db_cat_category.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Description</td> <td colspan="" width="80%" style="text-align: right;font-size: 12px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$description.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Transaction Link</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$tran_link.'</td> </tr> '.$customerMail.' <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Item Worth/Price</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$price_format.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Charges bearer</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$charges.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Total Charges</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">&#x20A6;'.$chrg.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Who pay the charges?</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$chrgs.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Buyer Pays</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$buyer_t_pay.'</td> </tr> <tr style="display: table-row;vertical-align: inherit;border-color: inherit;"> <td colspan="" width="20%" style="text-align: left;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">Seller Receives</td> <td colspan="" width="80%" style="text-align: right;font-size: 14px;border: 1px solid #ddd;padding: 8px;line-height: 1.428571429;vertical-align: top;border-top: 1px solid #ddd;">'.$seller_t_receives.'</td> </tr> </tbody> </table> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Mecom'. $year .' All Rights Reserved </div> </div>'; /* Finally send the mail. */ //$mail->send(); if (!$mail->send()){ /* PHPMailer error. */ echo $mail->ErrorInfo; }else{ echo "<script> window.onload = function() { sweetAlert({ title: 'Congratulations', text: 'Your transaction has been created successfully', type: 'success', confirmButtonColor: '#B6EA36' }, function () { window.location.href = './'; }); }; </script>"; } } catch (Exception $e) { /* PHPMailer exception. */ echo $e->errorMessage(); } catch (\Exception $e) { /* PHP exception (note the backslash to select the global namespace Exception class). */ echo $e->getMessage(); } // //End of second user register } } With this the second party got the two mail
  8. https://ravemodal-dev.herokuapp.com/hosted/redirect-payment?flwref=FLW-MOCK-ba043ffda2fad8a96ddd82b6c2a3dc5a&txref=996419 txref=996419 from the link is auto generated reference number
  9. redirect is a page to redirect to after successful payment
  10. Good afternoon everyone, Please I’m trying to integrate a rave pay payment gateway and i’m getting this below error on making payment Error: Cannot POST /hosted/redirect My redirect page code (redirect.php) <?php //session_start(); include 'includes/global/login_handler.php'; include 'includes/global/randStrGen.php'; if (isset($_GET['txref']) && isset($_SESSION["amount_to_pay"]) && isset($_SESSION["txtrefno"]) && isset($_SESSION["transact_no"]) && isset($_SESSION["buyer_email"]) && isset($_SESSION["buyer_name"]) && isset($_SESSION["seller_email"]) && isset($_SESSION["seller_name"])) { //my own variable declaration $buyer_t_pay_ =$_SESSION["amount_to_pay"]; $txtrefno =$_SESSION["txtrefno"]; $transact_no =$_SESSION['transact_no']; $buyer_email =$_SESSION['buyer_email']; $buyer_name =$_SESSION['buyer_name']; $seller_email =$_SESSION['seller_email']; $seller_name =$_SESSION['seller_name']; $category=$_SESSION['category']; $description=$_SESSION['description']; //end of my variable declaration $ref = $_GET['txref']; $amount = $_SESSION["amount_to_pay"]; //Correct Amount from Server $currency = "NGN"; //Correct Currency from Server $query = array( "SECKEY" => "2fsghddjk", "txref" => $ref ); $data_string = json_encode($query); $ch = curl_init('https://api.ravepay.co/flwv3-pug/getpaidx/api/v2/verify'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $response = curl_exec($ch); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); $body = substr($response, $header_size); curl_close($ch); $resp = json_decode($response, true); $paymentStatus = $resp['data']['status']; $chargeResponsecode = $resp['data']['chargecode']; $chargeAmount = $resp['data']['amount']; $chargeCurrency = $resp['data']['currency']; if (($chargeResponsecode == "00" || $chargeResponsecode == "0") && ($chargeAmount == $amount) && ($chargeCurrency == $currency)) { // transaction was successful... // please check other things like whether you already gave value for this ref // if the email matches the customer who owns the product etc //Give Value and return to Success page //header( "refresh:4;url=./success.php" ); $sql_payment ="insert into payment_history (transactID,amountPaid,transMode,refno) values('$transact_no','$buyer_t_pay_','1','$txtrefno')"; $payment_query = mysqli_query($con,$sql_payment); $payment_id = mysqli_insert_id($con); $sql_trans ="update trans_tbl set amt_pay='$buyer_t_pay_', payment_status='1', refno='$txtrefno' where transact_no='$transact_no'"; $transact_query = mysqli_query($con,$sql_trans); if ($transact_query && $payment_query){ $year = date('Y'); //send email to the buyer $to = $buyer_email; $from = "info@safetranzact.com"; $subject = "Payment Successful"; $message ='<div class="email-background" style="background: #eee;padding: 10px;"> <a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 20px;font-weight: bold;color: #002b49;line-height: 20px;text-align:center;word-break: normal;font-family: Helvetica,Arial,sans-serif;margin-left: 10px;margin-right: 10px;">Your payment to the item with transaction No: '. $transact_no .' of '.$category. ' has been confirmed<br/></p><hr> <p style="font-size: 14px;font-weight: bold;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 12px;"> Dear ' . $buyer_name. ',</p><br> <p style="font-size: 14px;font-weight: normal;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 20px;">Thanks for choosing Safetranzact. Your payment of transaction No <b>'. $transact_no . ' </b> of category <b> '. $category . '</b> with description <b>'.$description.'</b> is being processed. <br> If you have any comments about this transaction, please reach out to us at info@safetranzact.com</p> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Safetranzact Limited '. $year .' All Rights Reserved </div> </div>'; $headers = "From:$from\n"; $headers.="MINE-version:1.0\n"; $headers.="content-type:text/html; charset=iso-8859-1\n"; $mailing = mail($to,$subject,$message,$headers); //send email to the seller $to = $sender_email; $from = "info@safetranzact.com"; $subject = "Payment Successful"; $message ='<div class="email-background" style="background: #eee;padding: 10px;"> <a href="https://www.safetranzact.com"><center><img src="https://www.safetranzact.com/assets/images/fav.png" style="padding-top:30px;padding-bottom:30px;max-width:100px;margin: 0 auto;"></center><a> <div class="email-container" style="max-width: 500px;background: white;font-family: san-serif;margin: 0 auto;overflow: hidden;border-radius: 5px;text-align: center;"> <p style="margin: 20px;font-size: 20px;font-weight: bold;color: #002b49;line-height: 20px;text-align:center;word-break: normal;font-family: Helvetica,Arial,sans-serif;margin-left: 10px;margin-right: 10px;">Your payment to the item with transaction No: '. $transact_no .' of '.$category. ' has been confirmed<br/></p><hr> <p style="font-size: 14px;font-weight: bold;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 12px;"> Dear ' . $sender_name. ',</p><br> <p style="font-size: 14px;font-weight: normal;color: #002b49;text-align:left;margin-left: 10px;margin-right: 10px;line-height: 20px;">Thanks for choosing Safetranzact. We got a payment of transaction No <b>'. $transact_no . ' </b> of category <b> '. $category . '</b> with description <b>'.$description.'</b> from buyer <b>('.$buyer_name.')</b> .<br> Please ship the item now and log in to your dashboard to upload the shippment proof. <br>If you have any comments about this transaction, please reach out to us at info@safetranzact.com</p> </div> </div> <div class="footer-junk" style="background: none;padding: 20px;font-size: 12px;text-align: center;"> Copyright &copy; Safetranzact Limited '. $year .' All Rights Reserved </div> </div>'; $headers = "From:$from\n"; $headers.="MINE-version:1.0\n"; $headers.="content-type:text/html; charset=iso-8859-1\n"; $mailing = mail($to,$subject,$message,$headers); header( "refresh:3;url=./success" ); }else{ } } else { //Dont Give Value and return to Failure page header( "refresh:3;url=./failure" ); } } else { die('No reference supplied'); } ?> Please any help on this
  11. yeah that's for overall position for class. I'm talking of the subject position in the column. With this SELECT yearid , semesterid , regno , subjectid , rank , total , grade , comment FROM ( SELECT yearid , semesterid , subjectid , @seq := CASE WHEN yss <> @prev THEN 1 ELSE @seq + 1 END as seq , @rank := CASE WHEN total = @prevtot THEN @rank ELSE @seq END as rank , @prevtot := total as total , @prev := yss as yss , regno , armsLevelId -- added , armsid -- added FROM ( SELECT yearid , semesterid , subjectid , concat(yearid, semesterid, subjectid) as yss , regno , total , armsLevelId -- added , armsid -- added FROM subject_position ORDER BY yearid, semesterid, subjectid, total DESC ) sorted JOIN (SELECT @prev := '', @seq := 0, @rank := 0, @prevtot := 0) as init ) ranked JOIN grade ON total BETWEEN grade.lomark AND grade.himark WHERE regNo='$_GET[name]' -- A and armsLevelId='$_SESSION[level_id]' -- D and armsId='$_SESSION[arms]' -- D and semesterid='$_SESSION[semester]' -- E and yearid='$_SESSION[session]' -- D ORDER BY subjectid
  12. Ok sir. Look at the Sub Position column. and the number of student is in a class is 34 so we have 49th and 47th which is higher than number of student.
  13. Is there a way whereby user 7566 and 7057 that takes on rank 3, the next user which is 9208 and 7664 will take on rank 4 and so on so that the number of rank will not be more than the number of student in a class
  14. Compliment of the season Mr Barand. Thank you for your guide so far. I appreciate that. Please i wanted to ask, how can one resolve ties in ranking? I have the table DROP TABLE IF EXISTS `subject_position`; CREATE TABLE IF NOT EXISTS `subject_position` ( `id` int(11) NOT NULL AUTO_INCREMENT, `regNo` int(50) NOT NULL, `subjectid` int(50) NOT NULL, `armsLevelId` int(50) NOT NULL, `armsId` int(50) NOT NULL, `semesterid` int(50) NOT NULL, `yearid` int(50) NOT NULL, `total` int(50) NOT NULL, PRIMARY KEY (`id`) ) INSERT INTO `subject_position` (`id`, `regNo`, `subjectid`, `armsLevelId`, `armsId`, `semesterid`, `yearid`, `total`) VALUES (1, 2183, 1, 1, 1, 1, 10, 60), (2, 4253, 1, 1, 1, 1, 10, 94), (3, 8248, 1, 1, 1, 1, 10, 94), (4, 7032, 1, 1, 1, 1, 10, 60), (5, 9390, 1, 1, 1, 1, 10, 0), (6, 461, 1, 1, 1, 1, 10, 0), (7, 5072, 1, 1, 1, 1, 10, 50), (8, 3487, 1, 1, 1, 1, 10, 59), (9, 5938, 1, 1, 1, 1, 10, 65), (10, 7120, 1, 1, 1, 1, 10, 81), (11, 1352, 1, 1, 1, 1, 10, 88), (12, 4965, 1, 1, 1, 1, 10, 95), (13, 5896, 1, 1, 1, 1, 10, 65), (14, 9490, 1, 1, 1, 1, 10, 0), (15, 8835, 1, 1, 1, 1, 10, 88), (16, 4167, 1, 1, 1, 1, 10, 88), (17, 350, 1, 1, 1, 1, 10, 88), (18, 8255, 1, 1, 1, 1, 10, 82), (19, 4621, 1, 1, 1, 1, 10, 100), (20, 1011, 1, 1, 1, 1, 10, 82), (21, 6805, 1, 1, 1, 1, 10, 79), (22, 2808, 1, 1, 1, 1, 10, 70), (23, 9966, 1, 1, 1, 1, 10, 83), (24, 9738, 1, 1, 1, 1, 10, 43), (25, 2111, 1, 1, 1, 1, 10, 94), (26, 7833, 1, 1, 1, 1, 10, 99), (27, 5038, 1, 1, 1, 1, 10, 69), (28, 5897, 1, 1, 1, 1, 10, 63), (29, 6377, 1, 1, 1, 1, 10, 76), (30, 9208, 1, 1, 1, 1, 10, 96), (31, 9491, 1, 1, 1, 1, 10, 90), (32, 4984, 1, 1, 1, 1, 10, 87), (33, 8836, 1, 1, 1, 1, 10, 70), (34, 1398, 1, 1, 1, 1, 10, 85), (35, 2183, 2, 1, 1, 1, 10, 67), (36, 4253, 2, 1, 1, 1, 10, 94), (37, 8248, 2, 1, 1, 1, 10, 98), (38, 7032, 2, 1, 1, 1, 10, 85), (39, 9390, 2, 1, 1, 1, 10, 0), (40, 461, 2, 1, 1, 1, 10, 0), (41, 5072, 2, 1, 1, 1, 10, 68), (42, 3487, 2, 1, 1, 1, 10, 71), (43, 5938, 2, 1, 1, 1, 10, 59), (44, 7120, 2, 1, 1, 1, 10, 85), (45, 1352, 2, 1, 1, 1, 10, 88), (46, 4965, 2, 1, 1, 1, 10, 97), (47, 5896, 2, 1, 1, 1, 10, 68), (48, 9490, 2, 1, 1, 1, 10, 67), (49, 8835, 2, 1, 1, 1, 10, 86), (50, 4167, 2, 1, 1, 1, 10, 83), (51, 350, 2, 1, 1, 1, 10, 95), (52, 8255, 2, 1, 1, 1, 10, 75), (53, 4621, 2, 1, 1, 1, 10, 99), (54, 1011, 2, 1, 1, 1, 10, 88), (55, 6805, 2, 1, 1, 1, 10, 75), (56, 2808, 2, 1, 1, 1, 10, 78), (57, 9966, 2, 1, 1, 1, 10, 84), (58, 9738, 2, 1, 1, 1, 10, 52), (59, 2111, 2, 1, 1, 1, 10, 97), (60, 7833, 2, 1, 1, 1, 10, 100), (61, 5038, 2, 1, 1, 1, 10, 68), (62, 5897, 2, 1, 1, 1, 10, 80), (63, 6377, 2, 1, 1, 1, 10, 75), (64, 9208, 2, 1, 1, 1, 10, 96), (65, 9491, 2, 1, 1, 1, 10, 85), (66, 4984, 2, 1, 1, 1, 10, 86), (67, 8836, 2, 1, 1, 1, 10, 0), (68, 1398, 2, 1, 1, 1, 10, 77), (69, 2183, 6, 1, 1, 1, 10, 93), (70, 4253, 6, 1, 1, 1, 10, 100), (71, 8248, 6, 1, 1, 1, 10, 100), (72, 7032, 6, 1, 1, 1, 10, 0), (73, 9390, 6, 1, 1, 1, 10, 0), (74, 461, 6, 1, 1, 1, 10, 0), (75, 5072, 6, 1, 1, 1, 10, 87), (76, 3487, 6, 1, 1, 1, 10, 87), (77, 5938, 6, 1, 1, 1, 10, 90), (78, 7120, 6, 1, 1, 1, 10, 94), (79, 1352, 6, 1, 1, 1, 10, 98), (80, 4965, 6, 1, 1, 1, 10, 100), (81, 5896, 6, 1, 1, 1, 10, 92), (82, 9490, 6, 1, 1, 1, 10, 86), (83, 8835, 6, 1, 1, 1, 10, 100), (84, 4167, 6, 1, 1, 1, 10, 100), (85, 350, 6, 1, 1, 1, 10, 98), (86, 8255, 6, 1, 1, 1, 10, 96), (87, 4621, 6, 1, 1, 1, 10, 100), (88, 1011, 6, 1, 1, 1, 10, 99), (89, 6805, 6, 1, 1, 1, 10, 100), (90, 2808, 6, 1, 1, 1, 10, 90), (91, 9966, 6, 1, 1, 1, 10, 100), (92, 9738, 6, 1, 1, 1, 10, 78), (93, 2111, 6, 1, 1, 1, 10, 100), (94, 7833, 6, 1, 1, 1, 10, 100), (95, 5038, 6, 1, 1, 1, 10, 93), (96, 5897, 6, 1, 1, 1, 10, 98), (97, 6377, 6, 1, 1, 1, 10, 95), (98, 9208, 6, 1, 1, 1, 10, 100), (99, 9491, 6, 1, 1, 1, 10, 98), (100, 4984, 6, 1, 1, 1, 10, 99), (101, 8836, 6, 1, 1, 1, 10, 0), (102, 1398, 6, 1, 1, 1, 10, 87), (103, 3378, 1, 2, 1, 1, 10, 51), (104, 3641, 1, 2, 1, 1, 10, 88), (105, 3679, 1, 2, 1, 1, 10, 0), (106, 6970, 1, 2, 1, 1, 10, 81), (107, 8127, 1, 2, 1, 1, 10, 90), (108, 2451, 1, 2, 1, 1, 10, 93), (109, 3628, 1, 2, 1, 1, 10, 89), (110, 2393, 1, 2, 1, 1, 10, 82), (111, 8410, 1, 2, 1, 1, 10, 78), (112, 9207, 1, 2, 1, 1, 10, 65), (113, 3391, 1, 2, 1, 1, 10, 92), (114, 2660, 1, 2, 1, 1, 10, 76), (115, 9321, 1, 2, 1, 1, 10, 71), (116, 7664, 1, 2, 1, 1, 10, 96), (117, 4800, 1, 2, 1, 1, 10, 75), (118, 6982, 1, 2, 1, 1, 10, 91), (119, 8552, 1, 2, 1, 1, 10, 78), (120, 330, 1, 2, 1, 1, 10, 64), (121, 8038, 1, 2, 1, 1, 10, 76), (122, 9844, 1, 2, 1, 1, 10, 75), (123, 8113, 1, 2, 1, 1, 10, 0), (124, 4252, 1, 2, 1, 1, 10, 74), (125, 7566, 1, 2, 1, 1, 10, 98), (126, 2544, 1, 2, 1, 1, 10, 74), (127, 531, 1, 2, 1, 1, 10, 68), (128, 9569, 1, 2, 1, 1, 10, 81), (129, 7699, 1, 2, 1, 1, 10, 96), (130, 3378, 2, 2, 1, 1, 10, 50), (131, 3641, 2, 2, 1, 1, 10, 50), (132, 3679, 2, 2, 1, 1, 10, 0), (133, 6970, 2, 2, 1, 1, 10, 65), (134, 8127, 2, 2, 1, 1, 10, 93), (135, 2451, 2, 2, 1, 1, 10, 95), (136, 3628, 2, 2, 1, 1, 10, 90), (137, 2393, 2, 2, 1, 1, 10, 68), (138, 8410, 2, 2, 1, 1, 10, 78), (139, 9207, 2, 2, 1, 1, 10, 85), (140, 3391, 2, 2, 1, 1, 10, 91), (141, 2660, 2, 2, 1, 1, 10, 85), (142, 9321, 2, 2, 1, 1, 10, 65), (143, 7664, 2, 2, 1, 1, 10, 80), (144, 4800, 2, 2, 1, 1, 10, 74), (145, 6982, 2, 2, 1, 1, 10, 90), (146, 8552, 2, 2, 1, 1, 10, 50), (147, 330, 2, 2, 1, 1, 10, 63), (148, 8038, 2, 2, 1, 1, 10, 61), (149, 9844, 2, 2, 1, 1, 10, 60), (150, 8113, 2, 2, 1, 1, 10, 0), (151, 4252, 2, 2, 1, 1, 10, 68), (152, 7566, 2, 2, 1, 1, 10, 100), (153, 2544, 2, 2, 1, 1, 10, 67), (154, 531, 2, 2, 1, 1, 10, 95), (155, 9569, 2, 2, 1, 1, 10, 70), (156, 7699, 2, 2, 1, 1, 10, 100), (157, 3378, 3, 2, 1, 1, 10, 95), (158, 3641, 3, 2, 1, 1, 10, 80), (159, 3679, 3, 2, 1, 1, 10, 0), (160, 6970, 3, 2, 1, 1, 10, 85), (161, 8127, 3, 2, 1, 1, 10, 85), (162, 2451, 3, 2, 1, 1, 10, 95), (163, 3628, 3, 2, 1, 1, 10, 100), (164, 2393, 3, 2, 1, 1, 10, 82), (165, 8410, 3, 2, 1, 1, 10, 88), (166, 9207, 3, 2, 1, 1, 10, 75), (167, 3391, 3, 2, 1, 1, 10, 100), (168, 2660, 3, 2, 1, 1, 10, 80), (169, 9321, 3, 2, 1, 1, 10, 80), (170, 7664, 3, 2, 1, 1, 10, 100), (171, 4800, 3, 2, 1, 1, 10, 90), (172, 6982, 3, 2, 1, 1, 10, 80), (173, 8552, 3, 2, 1, 1, 10, 75), (174, 330, 3, 2, 1, 1, 10, 88), (175, 8038, 3, 2, 1, 1, 10, 85), (176, 9844, 3, 2, 1, 1, 10, 80), (177, 8113, 3, 2, 1, 1, 10, 0), (178, 4252, 3, 2, 1, 1, 10, 95), (179, 7566, 3, 2, 1, 1, 10, 98), (180, 2544, 3, 2, 1, 1, 10, 80), (181, 531, 3, 2, 1, 1, 10, 88), (182, 9569, 3, 2, 1, 1, 10, 85), (183, 7699, 3, 2, 1, 1, 10, 100), (184, 3378, 4, 2, 1, 1, 10, 80), (185, 3641, 4, 2, 1, 1, 10, 68), (186, 3679, 4, 2, 1, 1, 10, 0), (187, 6970, 4, 2, 1, 1, 10, 78), (188, 8127, 4, 2, 1, 1, 10, 100), (189, 2451, 4, 2, 1, 1, 10, 100), (190, 3628, 4, 2, 1, 1, 10, 90), (191, 2393, 4, 2, 1, 1, 10, 78), (192, 8410, 4, 2, 1, 1, 10, 70), (193, 9207, 4, 2, 1, 1, 10, 60), (194, 3391, 4, 2, 1, 1, 10, 100), (195, 2660, 4, 2, 1, 1, 10, 100), (196, 9321, 4, 2, 1, 1, 10, 55), (197, 7664, 4, 2, 1, 1, 10, 95), (198, 4800, 4, 2, 1, 1, 10, 85), (199, 6982, 4, 2, 1, 1, 10, 90), (200, 8552, 4, 2, 1, 1, 10, 50), (201, 330, 4, 2, 1, 1, 10, 65), (202, 8038, 4, 2, 1, 1, 10, 68), (203, 9844, 4, 2, 1, 1, 10, 50), (204, 8113, 4, 2, 1, 1, 10, 0), (205, 4252, 4, 2, 1, 1, 10, 85), (206, 7566, 4, 2, 1, 1, 10, 100), (207, 2544, 4, 2, 1, 1, 10, 80), (208, 531, 4, 2, 1, 1, 10, 90), (209, 9569, 4, 2, 1, 1, 10, 55), (210, 7699, 4, 2, 1, 1, 10, 100), (211, 3378, 5, 2, 1, 1, 10, 100), (212, 3641, 5, 2, 1, 1, 10, 88), (213, 3679, 5, 2, 1, 1, 10, 0), (214, 6970, 5, 2, 1, 1, 10, 88), (215, 8127, 5, 2, 1, 1, 10, 100), (216, 2451, 5, 2, 1, 1, 10, 100), (217, 3628, 5, 2, 1, 1, 10, 88), (218, 2393, 5, 2, 1, 1, 10, 85), (219, 8410, 5, 2, 1, 1, 10, 90), (220, 9207, 5, 2, 1, 1, 10, 79), (221, 3391, 5, 2, 1, 1, 10, 100), (222, 2660, 5, 2, 1, 1, 10, 98), (223, 9321, 5, 2, 1, 1, 10, 90), (224, 7664, 5, 2, 1, 1, 10, 100), (225, 4800, 5, 2, 1, 1, 10, 100), (226, 6982, 5, 2, 1, 1, 10, 100), (227, 8552, 5, 2, 1, 1, 10, 78), (228, 330, 5, 2, 1, 1, 10, 100), (229, 8038, 5, 2, 1, 1, 10, 90), (230, 9844, 5, 2, 1, 1, 10, 80), (231, 8113, 5, 2, 1, 1, 10, 0), (232, 4252, 5, 2, 1, 1, 10, 99), (233, 7566, 5, 2, 1, 1, 10, 100), (234, 2544, 5, 2, 1, 1, 10, 85), (235, 531, 5, 2, 1, 1, 10, 90), (236, 9569, 5, 2, 1, 1, 10, 100), (237, 7699, 5, 2, 1, 1, 10, 100), (238, 3378, 6, 2, 1, 1, 10, 60), (239, 3641, 6, 2, 1, 1, 10, 93), (240, 3679, 6, 2, 1, 1, 10, 0), (241, 6970, 6, 2, 1, 1, 10, 90), (242, 8127, 6, 2, 1, 1, 10, 90), (243, 2451, 6, 2, 1, 1, 10, 100), (244, 3628, 6, 2, 1, 1, 10, 83), (245, 2393, 6, 2, 1, 1, 10, 70), (246, 8410, 6, 2, 1, 1, 10, 100), (247, 9207, 6, 2, 1, 1, 10, 100), (248, 3391, 6, 2, 1, 1, 10, 95), (249, 2660, 6, 2, 1, 1, 10, 100), (250, 9321, 6, 2, 1, 1, 10, 90), (251, 7664, 6, 2, 1, 1, 10, 85), (252, 4800, 6, 2, 1, 1, 10, 70), (253, 6982, 6, 2, 1, 1, 10, 80), (254, 8552, 6, 2, 1, 1, 10, 80), (255, 330, 6, 2, 1, 1, 10, 80), (256, 8038, 6, 2, 1, 1, 10, 90), (257, 9844, 6, 2, 1, 1, 10, 45), (258, 8113, 6, 2, 1, 1, 10, 0), (259, 4252, 6, 2, 1, 1, 10, 80), (260, 7566, 6, 2, 1, 1, 10, 100), (261, 2544, 6, 2, 1, 1, 10, 55), (262, 531, 6, 2, 1, 1, 10, 66), (263, 9569, 6, 2, 1, 1, 10, 65), (264, 7699, 6, 2, 1, 1, 10, 80), (265, 3378, 24, 2, 1, 1, 10, 75), (266, 3641, 24, 2, 1, 1, 10, 76), (267, 3679, 24, 2, 1, 1, 10, 0), (268, 6970, 24, 2, 1, 1, 10, 69), (269, 8127, 24, 2, 1, 1, 10, 90), (270, 2451, 24, 2, 1, 1, 10, 86), (271, 3628, 24, 2, 1, 1, 10, 76), (272, 2393, 24, 2, 1, 1, 10, 73), (273, 8410, 24, 2, 1, 1, 10, 66), (274, 9207, 24, 2, 1, 1, 10, 55), (275, 3391, 24, 2, 1, 1, 10, 80), (276, 2660, 24, 2, 1, 1, 10, 64), (277, 9321, 24, 2, 1, 1, 10, 71), (278, 7664, 24, 2, 1, 1, 10, 100), (279, 4800, 24, 2, 1, 1, 10, 82), (280, 6982, 24, 2, 1, 1, 10, 86), (281, 8552, 24, 2, 1, 1, 10, 96), (282, 330, 24, 2, 1, 1, 10, 57), (283, 8038, 24, 2, 1, 1, 10, 72), (284, 9844, 24, 2, 1, 1, 10, 60), (285, 8113, 24, 2, 1, 1, 10, 0), (286, 4252, 24, 2, 1, 1, 10, 80), (287, 7566, 24, 2, 1, 1, 10, 91), (288, 2544, 24, 2, 1, 1, 10, 77), (289, 531, 24, 2, 1, 1, 10, 66), (290, 9569, 24, 2, 1, 1, 10, 55), (291, 7699, 24, 2, 1, 1, 10, 87), (292, 3378, 27, 2, 1, 1, 10, 70), (293, 3641, 27, 2, 1, 1, 10, 50), (294, 3679, 27, 2, 1, 1, 10, 0), (295, 6970, 27, 2, 1, 1, 10, 60), (296, 8127, 27, 2, 1, 1, 10, 90), (297, 2451, 27, 2, 1, 1, 10, 70), (298, 3628, 27, 2, 1, 1, 10, 90), (299, 2393, 27, 2, 1, 1, 10, 58), (300, 8410, 27, 2, 1, 1, 10, 70), (301, 9207, 27, 2, 1, 1, 10, 60), (302, 3391, 27, 2, 1, 1, 10, 100), (303, 2660, 27, 2, 1, 1, 10, 70), (304, 9321, 27, 2, 1, 1, 10, 77), (305, 7664, 27, 2, 1, 1, 10, 70), (306, 4800, 27, 2, 1, 1, 10, 58), (307, 6982, 27, 2, 1, 1, 10, 70), (308, 8552, 27, 2, 1, 1, 10, 70), (309, 330, 27, 2, 1, 1, 10, 95), (310, 8038, 27, 2, 1, 1, 10, 60), (311, 9844, 27, 2, 1, 1, 10, 56), (312, 8113, 27, 2, 1, 1, 10, 0), (313, 4252, 27, 2, 1, 1, 10, 65), (314, 7566, 27, 2, 1, 1, 10, 85), (315, 2544, 27, 2, 1, 1, 10, 65), (316, 531, 27, 2, 1, 1, 10, 65), (317, 9569, 27, 2, 1, 1, 10, 60), (318, 7699, 27, 2, 1, 1, 10, 80), (319, 3378, 28, 2, 1, 1, 10, 95), (320, 3641, 28, 2, 1, 1, 10, 87), (321, 3679, 28, 2, 1, 1, 10, 0), (322, 6970, 28, 2, 1, 1, 10, 82), (323, 8127, 28, 2, 1, 1, 10, 90), (324, 2451, 28, 2, 1, 1, 10, 95), (325, 3628, 28, 2, 1, 1, 10, 78), (326, 2393, 28, 2, 1, 1, 10, 87), (327, 8410, 28, 2, 1, 1, 10, 95), (328, 9207, 28, 2, 1, 1, 10, 73), (329, 3391, 28, 2, 1, 1, 10, 95), (330, 2660, 28, 2, 1, 1, 10, 85), (331, 9321, 28, 2, 1, 1, 10, 79), (332, 7664, 28, 2, 1, 1, 10, 100), (333, 4800, 28, 2, 1, 1, 10, 85), (334, 6982, 28, 2, 1, 1, 10, 90), (335, 8552, 28, 2, 1, 1, 10, 74), (336, 330, 28, 2, 1, 1, 10, 45), (337, 8038, 28, 2, 1, 1, 10, 81), (338, 9844, 28, 2, 1, 1, 10, 69), (339, 8113, 28, 2, 1, 1, 10, 0), (340, 4252, 28, 2, 1, 1, 10, 95), (341, 7566, 28, 2, 1, 1, 10, 100), (342, 2544, 28, 2, 1, 1, 10, 72), (343, 531, 28, 2, 1, 1, 10, 95), (344, 9569, 28, 2, 1, 1, 10, 66), (345, 7699, 28, 2, 1, 1, 10, 100), (346, 3378, 29, 2, 1, 1, 10, 75), (347, 3641, 29, 2, 1, 1, 10, 55), (348, 3679, 29, 2, 1, 1, 10, 0), (349, 6970, 29, 2, 1, 1, 10, 75), (350, 8127, 29, 2, 1, 1, 10, 84), (351, 2451, 29, 2, 1, 1, 10, 80), (352, 3628, 29, 2, 1, 1, 10, 65), (353, 2393, 29, 2, 1, 1, 10, 70), (354, 8410, 29, 2, 1, 1, 10, 65), (355, 9207, 29, 2, 1, 1, 10, 90), (356, 3391, 29, 2, 1, 1, 10, 88), (357, 2660, 29, 2, 1, 1, 10, 90), (358, 9321, 29, 2, 1, 1, 10, 60), (359, 7664, 29, 2, 1, 1, 10, 75), (360, 4800, 29, 2, 1, 1, 10, 85), (361, 6982, 29, 2, 1, 1, 10, 100), (362, 8552, 29, 2, 1, 1, 10, 50), (363, 330, 29, 2, 1, 1, 10, 85), (364, 8038, 29, 2, 1, 1, 10, 65), (365, 9844, 29, 2, 1, 1, 10, 55), (366, 8113, 29, 2, 1, 1, 10, 0), (367, 4252, 29, 2, 1, 1, 10, 70), (368, 7566, 29, 2, 1, 1, 10, 98), (369, 2544, 29, 2, 1, 1, 10, 78), (370, 531, 29, 2, 1, 1, 10, 90), (371, 9569, 29, 2, 1, 1, 10, 60), (372, 7699, 29, 2, 1, 1, 10, 70), (373, 3576, 1, 3, 1, 1, 10, 85), (374, 9079, 1, 3, 1, 1, 10, 66), (375, 6409, 1, 3, 1, 1, 10, 87), (376, 9197, 1, 3, 1, 1, 10, 88), (377, 8660, 1, 3, 1, 1, 10, 78), (378, 137, 1, 3, 1, 1, 10, 70), (379, 1477, 1, 3, 1, 1, 10, 78), (380, 7057, 1, 3, 1, 1, 10, 98), (381, 4608, 1, 3, 1, 1, 10, 93), (382, 3576, 2, 3, 1, 1, 10, 60), (383, 9079, 2, 3, 1, 1, 10, 93), (384, 6409, 2, 3, 1, 1, 10, 98), (385, 9197, 2, 3, 1, 1, 10, 100), (386, 8660, 2, 3, 1, 1, 10, 97), (387, 137, 2, 3, 1, 1, 10, 90), (388, 1477, 2, 3, 1, 1, 10, 96), (389, 7057, 2, 3, 1, 1, 10, 100), (390, 4608, 2, 3, 1, 1, 10, 100), (391, 3576, 3, 3, 1, 1, 10, 85), (392, 9079, 3, 3, 1, 1, 10, 60), (393, 6409, 3, 3, 1, 1, 10, 98), (394, 9197, 3, 3, 1, 1, 10, 98), (395, 8660, 3, 3, 1, 1, 10, 95), (396, 137, 3, 3, 1, 1, 10, 80), (397, 1477, 3, 3, 1, 1, 10, 98), (398, 7057, 3, 3, 1, 1, 10, 100), (399, 4608, 3, 3, 1, 1, 10, 95), (400, 3576, 4, 3, 1, 1, 10, 85), (401, 9079, 4, 3, 1, 1, 10, 75), (402, 6409, 4, 3, 1, 1, 10, 90), (403, 9197, 4, 3, 1, 1, 10, 94), (404, 8660, 4, 3, 1, 1, 10, 93), (405, 137, 4, 3, 1, 1, 10, 85), (406, 1477, 4, 3, 1, 1, 10, 87), (407, 7057, 4, 3, 1, 1, 10, 90), (408, 4608, 4, 3, 1, 1, 10, 94), (409, 3576, 5, 3, 1, 1, 10, 55), (410, 9079, 5, 3, 1, 1, 10, 88), (411, 6409, 5, 3, 1, 1, 10, 87), (412, 9197, 5, 3, 1, 1, 10, 91), (413, 8660, 5, 3, 1, 1, 10, 80), (414, 137, 5, 3, 1, 1, 10, 70), (415, 1477, 5, 3, 1, 1, 10, 90), (416, 7057, 5, 3, 1, 1, 10, 86), (417, 4608, 5, 3, 1, 1, 10, 85), (418, 3576, 6, 3, 1, 1, 10, 85), (419, 9079, 6, 3, 1, 1, 10, 90), (420, 6409, 6, 3, 1, 1, 10, 75), (421, 9197, 6, 3, 1, 1, 10, 80), (422, 8660, 6, 3, 1, 1, 10, 85), (423, 137, 6, 3, 1, 1, 10, 70), (424, 1477, 6, 3, 1, 1, 10, 99), (425, 7057, 6, 3, 1, 1, 10, 95), (426, 4608, 6, 3, 1, 1, 10, 98), (427, 3576, 24, 3, 1, 1, 10, 70), (428, 9079, 24, 3, 1, 1, 10, 93), (429, 6409, 24, 3, 1, 1, 10, 88), (430, 9197, 24, 3, 1, 1, 10, 90), (431, 8660, 24, 3, 1, 1, 10, 92), (432, 137, 24, 3, 1, 1, 10, 70), (433, 1477, 24, 3, 1, 1, 10, 93), (434, 7057, 24, 3, 1, 1, 10, 88), (435, 4608, 24, 3, 1, 1, 10, 90), (436, 3576, 27, 3, 1, 1, 10, 100), (437, 9079, 27, 3, 1, 1, 10, 80), (438, 6409, 27, 3, 1, 1, 10, 80), (439, 9197, 27, 3, 1, 1, 10, 100), (440, 8660, 27, 3, 1, 1, 10, 75), (441, 137, 27, 3, 1, 1, 10, 80), (442, 1477, 27, 3, 1, 1, 10, 100), (443, 7057, 27, 3, 1, 1, 10, 100), (444, 4608, 27, 3, 1, 1, 10, 100), (445, 3576, 28, 3, 1, 1, 10, 88), (446, 9079, 28, 3, 1, 1, 10, 81), (447, 6409, 28, 3, 1, 1, 10, 93), (448, 9197, 28, 3, 1, 1, 10, 92), (449, 8660, 28, 3, 1, 1, 10, 93), (450, 137, 28, 3, 1, 1, 10, 65), (451, 1477, 28, 3, 1, 1, 10, 82), (452, 7057, 28, 3, 1, 1, 10, 91), (453, 4608, 28, 3, 1, 1, 10, 93), (454, 936, 1, 4, 1, 1, 10, 95), (455, 8664, 1, 4, 1, 1, 10, 90), (456, 7177, 1, 4, 1, 1, 10, 85), (457, 971, 1, 4, 1, 1, 10, 80), (458, 5007, 1, 4, 1, 1, 10, 90), (459, 9515, 1, 4, 1, 1, 10, 95), (460, 9978, 1, 4, 1, 1, 10, 85), (461, 6782, 1, 4, 1, 1, 10, 95), (462, 2828, 1, 4, 1, 1, 10, 75), (463, 936, 2, 4, 1, 1, 10, 90), (464, 8664, 2, 4, 1, 1, 10, 100), (465, 7177, 2, 4, 1, 1, 10, 100), (466, 971, 2, 4, 1, 1, 10, 83), (467, 5007, 2, 4, 1, 1, 10, 100), (468, 9515, 2, 4, 1, 1, 10, 100), (469, 9978, 2, 4, 1, 1, 10, 95), (470, 6782, 2, 4, 1, 1, 10, 95), (471, 2828, 2, 4, 1, 1, 10, 85), (472, 936, 3, 4, 1, 1, 10, 35), (473, 8664, 3, 4, 1, 1, 10, 90), (474, 7177, 3, 4, 1, 1, 10, 85), (475, 971, 3, 4, 1, 1, 10, 85), (476, 5007, 3, 4, 1, 1, 10, 90), (477, 9515, 3, 4, 1, 1, 10, 90), (478, 9978, 3, 4, 1, 1, 10, 90), (479, 6782, 3, 4, 1, 1, 10, 85), (480, 2828, 3, 4, 1, 1, 10, 70), (481, 936, 4, 4, 1, 1, 10, 85), (482, 8664, 4, 4, 1, 1, 10, 80), (483, 7177, 4, 4, 1, 1, 10, 85), (484, 971, 4, 4, 1, 1, 10, 85), (485, 5007, 4, 4, 1, 1, 10, 75), (486, 9515, 4, 4, 1, 1, 10, 90), (487, 9978, 4, 4, 1, 1, 10, 85), (488, 6782, 4, 4, 1, 1, 10, 85), (489, 2828, 4, 4, 1, 1, 10, 80), (490, 936, 5, 4, 1, 1, 10, 90), (491, 8664, 5, 4, 1, 1, 10, 90), (492, 7177, 5, 4, 1, 1, 10, 85), (493, 971, 5, 4, 1, 1, 10, 65), (494, 5007, 5, 4, 1, 1, 10, 90), (495, 9515, 5, 4, 1, 1, 10, 85), (496, 9978, 5, 4, 1, 1, 10, 90), (497, 6782, 5, 4, 1, 1, 10, 95), (498, 2828, 5, 4, 1, 1, 10, 95), (499, 936, 6, 4, 1, 1, 10, 90), (500, 8664, 6, 4, 1, 1, 10, 90), (501, 7177, 6, 4, 1, 1, 10, 80), (502, 971, 6, 4, 1, 1, 10, 60), (503, 5007, 6, 4, 1, 1, 10, 90), (504, 9515, 6, 4, 1, 1, 10, 90), (505, 9978, 6, 4, 1, 1, 10, 90), (506, 6782, 6, 4, 1, 1, 10, 100), (507, 2828, 6, 4, 1, 1, 10, 80), (508, 936, 24, 4, 1, 1, 10, 90), (509, 8664, 24, 4, 1, 1, 10, 95), (510, 7177, 24, 4, 1, 1, 10, 85), (511, 971, 24, 4, 1, 1, 10, 95), (512, 5007, 24, 4, 1, 1, 10, 90), (513, 9515, 24, 4, 1, 1, 10, 90), (514, 9978, 24, 4, 1, 1, 10, 90), (515, 6782, 24, 4, 1, 1, 10, 95), (516, 2828, 24, 4, 1, 1, 10, 90), (517, 936, 26, 4, 1, 1, 10, 90), (518, 8664, 26, 4, 1, 1, 10, 90), (519, 7177, 26, 4, 1, 1, 10, 90), (520, 971, 26, 4, 1, 1, 10, 90), (521, 5007, 26, 4, 1, 1, 10, 90), (522, 9515, 26, 4, 1, 1, 10, 90), (523, 9978, 26, 4, 1, 1, 10, 90), (524, 6782, 26, 4, 1, 1, 10, 85), (525, 2828, 26, 4, 1, 1, 10, 90), (526, 936, 27, 4, 1, 1, 10, 90), (527, 8664, 27, 4, 1, 1, 10, 95), (528, 7177, 27, 4, 1, 1, 10, 90), (529, 971, 27, 4, 1, 1, 10, 80), (530, 5007, 27, 4, 1, 1, 10, 90), (531, 9515, 27, 4, 1, 1, 10, 80), (532, 9978, 27, 4, 1, 1, 10, 80), (533, 6782, 27, 4, 1, 1, 10, 80), (534, 2828, 27, 4, 1, 1, 10, 80), (535, 936, 28, 4, 1, 1, 10, 35), (536, 8664, 28, 4, 1, 1, 10, 95), (537, 7177, 28, 4, 1, 1, 10, 90), (538, 971, 28, 4, 1, 1, 10, 85), (539, 5007, 28, 4, 1, 1, 10, 90), (540, 9515, 28, 4, 1, 1, 10, 95), (541, 9978, 28, 4, 1, 1, 10, 85), (542, 6782, 28, 4, 1, 1, 10, 85), (543, 2828, 28, 4, 1, 1, 10, 80), (544, 936, 29, 4, 1, 1, 10, 90), (545, 8664, 29, 4, 1, 1, 10, 95), (546, 7177, 29, 4, 1, 1, 10, 85), (547, 971, 29, 4, 1, 1, 10, 90), (548, 5007, 29, 4, 1, 1, 10, 90), (549, 9515, 29, 4, 1, 1, 10, 95), (550, 9978, 29, 4, 1, 1, 10, 90), (551, 6782, 29, 4, 1, 1, 10, 90), (552, 2828, 29, 4, 1, 1, 10, 95);
  15. Bravo.. This worked thanks Mr Barand for your guide and time. God bless you Abundantly sir
  16. I wrote this by removing all the semesterid in the where clause and i got this output SELECT yearid , semesterid , regno , total , rank , numstudents as `Total students` , grade as `Average grade` , comment FROM ( SELECT yearid , semesterid , @seq := CASE WHEN yss <> @prev THEN 1 ELSE @seq + 1 END as seq , @rank := CASE WHEN total = @prevtot THEN @rank ELSE @seq END as rank , @prevtot := total as total , @prev := yss as yss , regno , armsLevelId , armsid , avgtotal FROM ( SELECT yearid , semesterid , subjectid , concat(yearid, semesterid, armsid, armsLevelId) as yss , regno , SUM(total) as total , ROUND(AVG(total)) as avgtotal , armsLevelId , armsid FROM subject_position GROUP BY yearid, semesterid, armsid, armsLevelId,regno ORDER BY yearid, semesterid, armsid, armsLevelId, total DESC ) sorted JOIN (SELECT @prev := '', @seq := 0, @rank := 0, @prevtot := 0) as init ) ranked JOIN grade ON avgtotal BETWEEN grade.lomark and grade.himark JOIN ( SELECT yearid , semesterid , armsLevelId , armsid , COUNT(DISTINCT regno) as numstudents FROM subject_position GROUP BY yearid, semesterid, armsid, armsLevelId ) students USING (yearid, semesterid, armsid, armsLevelId) WHERE regno = '6073' -- uncomment for individual student and armsLevelId='1' and armsId='1' and yearid='1' ORDER BY regno; what i wanted is the summation of the total i.e for user 4663 overall score (903+873+733 = 2509) while user 6073 overall score (977+974+777 = 2728) then rank the total.
  17. I want to select and rank all records where semesterid is 1,2,3 which will allow me to compute the annual ranking
  18. I have student table Already sir. if i want to calculate the overall semesterid, yearid, armslevelid, armsid. and rank the student for 1st term, 2nd term and 3rd term result. this is my query SELECT yearid , semesterid , regno , total , rank , numstudents as `Total students` , grade as `Average grade` , comment FROM ( SELECT yearid , semesterid , @seq := CASE WHEN yss <> @prev THEN 1 ELSE @seq + 1 END as seq , @rank := CASE WHEN total = @prevtot THEN @rank ELSE @seq END as rank , @prevtot := total as total , @prev := yss as yss , regno , armsLevelId , armsid , avgtotal FROM ( SELECT yearid , semesterid , subjectid , concat(yearid, semesterid, armsid, armsLevelId) as yss , regno , SUM(total) as total , ROUND(AVG(total)) as avgtotal , armsLevelId , armsid FROM subject_position GROUP BY yearid, semesterid, armsid, armsLevelId,regno ORDER BY yearid, semesterid, armsid, armsLevelId, total DESC ) sorted JOIN (SELECT @prev := '', @seq := 0, @rank := 0, @prevtot := 0) as init ) ranked JOIN grade ON avgtotal BETWEEN grade.lomark and grade.himark JOIN ( SELECT yearid , semesterid , armsLevelId , armsid , COUNT(DISTINCT regno) as numstudents FROM subject_position GROUP BY yearid, semesterid, armsid, armsLevelId ) students USING (yearid, semesterid, armsid, armsLevelId) WHERE -- regno = 4663 and -- uncomment for individual student armsLevelId='1' and armsId='1' and semesterid='1' and semesterid='2' and semesterid='3' and yearid='1' ORDER BY regno; but i got empty row. Any clue on this sir?
  19. Yeah this is what i wanted. I got it thanks.. I need to study the query the is superb. Thank you sir. I appreciate
  20. Good morning sir Mr Barand. Thanks for yesterday. I've tried the remaining script of the subject position and it works well. Thank you. I want to use the same approach to get the rank of overall student which will include the rank and number of student in a class i.e. 1st of out 30 students (Note: the 1st is the overall rank of a student in a class while the 30 is the number of students in a class) This is the query i wrote, To get this, I will need to Sum the total score of a student in a class for a particular semester, year, level and arms and then rank it among students. SELECT yearid , semesterid , regno , subjectid , rank , SUM(total) , grade , comment FROM ( SELECT yearid , semesterid , subjectid , @seq := CASE WHEN yss <> @prev THEN 1 ELSE @seq + 1 END as seq , @rank := CASE WHEN total = @prevtot THEN @rank ELSE @seq END as rank , @prevtot := total as total , @prev := yss as yss , regno , armsLevelId -- added , armsid -- added FROM ( SELECT yearid , semesterid , subjectid , concat(yearid, semesterid, subjectid) as yss , regno , total , armsLevelId -- added , armsid -- added FROM subject_position ORDER BY yearid, semesterid, subjectid, total DESC ) sorted JOIN (SELECT @prev := '', @seq := 0, @rank := 0, @prevtot := 0) as init ) ranked JOIN grade ON total BETWEEN grade.lomark AND grade.himark WHERE regNo='4663' -- A and armsLevelId='1' -- D and armsId='1' -- D and semesterid='1' -- E and yearid='1' -- D ORDER BY subjectid for user 4663 for user 6073 Instead of user 4663 take rank 2 while user 6073 take on rank 1. Any clue on this sir
  21. Thanks I grab. arms(This is the level arms a student belong i.e. A,B,C,D....) while armsLevel (This is the Level a student belong to i.e JS1, JS2, JS3, ...). So a student can belong to JS1A, JS1B, JS1C, JS2A, JS2B, JS2C .......
  22. How can i know the actual number of student in a class for a particular armsLevelId, armsId, semesterid, and yearid from the below my Query My query SELECT COUNT(id) FROM `subject_position` WHERE armsLevelId='1' and armsId='1' and semesterid='1' and yearid='1' group by regNo Expected Output should be 2. Any clue on this?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.