lilseeam Posted August 13, 2013 Share Posted August 13, 2013 Please this code is a reciept code whereby when a customer is able to make successful payment his data will be stored in a database table and also if the customer is not able to make successful payment his data will be stored in another table and also if payment is pending or cancelled it will also be stored in a different table. So far i have written this code, but the issue it whether the customer is able to make payment or not they all end up in one table and that is not what i want. Please i need help how to solve this issue that is why i have provided my code below... <?php session_start(); require_once("mpower.php"); require_once("mpower_config.php"); require_once("admin/connection/conn.php"); // MPower will automatically set the confirm token to QUERY_STRING // param $_GET['token'] if not explicitly specified $token = $_GET["token"]; $invoice = new MPower_Checkout_Invoice(); if ($invoice->confirm($token)) { // if($invoice->getCustomData("ticketnum")==$_SESSION["TICKETNUMBER"]) { echo $orderid=$invoice->getCustomData("orderid"); // Retrieving Invoice Status // Status can be either completed, pending, canceled, fail $invoice->getStatus(); $invoice->getCustomData("ticketnum"); if($invoice->getStatus()=="completed") { $qry='update pcustomerorder set flag = "1" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } /*else if($invoice->getStatus()=="pending") { $qry='update pcustomerorder set flag = "2" where pcustomerorderid ="'.$orderid.'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); }*/ else if($invoice->getStatus()=="canceled") { $qry='update pcustomerorder set flag = "0" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } else if($invoice->getStatus()=="fail") { $qry='update pcustomerorder set flag = "0" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } // You can retrieve the Name, Email & Phone Number // of the customer using the callbacks below //$invoice->getCustomerInfo('name'); //$invoice->getCustomerInfo('email'); //$invoice->getCustomerInfo('phone'); // Return the URL to the Invoice Receipt PDF file for download //$invoice->getReceiptUrl(); // Retrieving any custom data you have added to the invoice // Please remember to use the right keys you used to set them earlier //$invoice->getCustomData("Firstname"); //$invoice->getCustomData("CartId"); //$invoice->getCustomData("Plan"); // You can also callback the total amount set earlier //$invoice->getTotalAmount(); } }else{ $invoice->getStatus(); $invoice->response_text; $invoice->response_code; header("Location: error.php?err=".$invoice->response_text); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/281128-not-getting-data-in-database/ Share on other sites More sharing options...
mikosiko Posted August 13, 2013 Share Posted August 13, 2013 .... when a customer is able to make successful payment his data will be stored in a database table and also if the customer is not able to make successful payment his data will be stored in another table and also if payment is pending or cancelled it will also be stored in a different table. ..... The code that you posted doesn't have ANY VISIBLE sql INSERT to store data in any table.... it has only UPDATES for one table based on the status.... without seen the code with the INSERTS help is not possible. Quote Link to comment https://forums.phpfreaks.com/topic/281128-not-getting-data-in-database/#findComment-1444782 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.