#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    2

    Update MYsql Database once results return from payment centre


    i have a table in my database called CustOrders that has a column called "fulfilled". i have some code and variables that are passed back from the payment store but dont know how or where to add the UPDATE SQL statement with what i have been given,, to update the fulfilled column

    the variable that needs to be inserted into the column is $StatusCode


    Can anyone help please?

    PHP Code:
    <div class="<?= $MessageClass ?>">
              <div class="TransactionResultsItem">
                        <div class="TransactionResultsLabel">Payment Processor Response:</div>
                        <div class="TransactionResultsText">
                                  <?= $Message ?>
                        </div>
              </div>
     
     
    <?php if ($DuplicateTransaction == true) { ?>
              <div style="color:#000;margin-top:10px">
                        A duplicate transaction means that a transaction with these details
                        has already been processed by the payment provider. The details of
                        the original transaction are given below
              </div>
              <div class="TransactionResultsItem" style="margin-top:10px">
                        <div class="TransactionResultsLabel">
                                  Previous Transaction Response:
                        </div>
                        <div class="TransactionResultsText">
                                  <?= $PreviousTransactionMessage ?>
                        </div>
              </div>
    <?php ?>
    <div style="margin-top:10px">
    <hr/>
    <?php
    echo "<strong>Variables Passed Back From The Gateway</strong>";
    echo 
    "<hr/>";
    echo 
    "Message: " $Message "<br/>";
    echo 
    "Status Code: " $StatusCode "<br/>";
    echo 
    "Previous Status Code: "$PreviousStatusCode "<br/>";
    echo 
    "Previous Message: " $PreviousMessage "<br/>";
    echo 
    "Cross Referrence: " $CrossReference "<br/>";
    echo 
    "Card Type: " $CardType "<br/>";
    echo 
    "Card Class: " $CardClass "<br/>";
    echo 
    "Card Issuer: " $CardIssuer "<br/>";
    echo 
    "Card Issuer Country Code: " $CardIssuerCountryCode "<br/>";
    echo 
    "Amount: " $Amount "<br/>";
    echo 
    "Currency Code: " $CurrencyCode "<br/>";
    echo 
    "Order ID: " $OrderID "<br/>";
    echo 
    "Transaction Type: " $TransactionType "<br/>";
    echo 
    "Transaction Date Time: " $TransactionDateTime "<br/>";
    echo 
    "Order Description: " $OrderDescription "<br/>";
    echo 
    "Customer Name: " $CustomerName "<br/>";
    echo 
    "Address Line 1: " $Address1 "<br/>";
    echo 
    "Address Line 2: " $Address2 "<br/>";
    echo 
    "Address Line 3: " $Address3 "<br/>";
    echo 
    "Address Line 4: " $Address4 "<br/>";
    echo 
    "City: " $City "<br/>";
    echo 
    "State: " $State "<br/>";
    echo 
    "PostCode: " $PostCode "<br/>";
    echo 
    "Country Code: " $CountryCode "<br/>";
    echo 
    "Email Address: " $EmailAddress "<br/>";
    echo 
    "Phone Number: " $PhoneNumber "<br/>";
    echo 
    "<hr/>";
    ?>
     
     
    </div>
     
     
              <div style="margin-top:10px">
                        <a href="index.html">Process Another</a>
              </div>
    </div>
     
    <!-- Database update using PHP -->
    <?php
    /*
    $host="";
    $user="";
    $password="";
     
     
    $database_connection = mysql_connect($host,$user,$password);
    if (!$database_connection)
      {
      die('Could not connect: ' . mysql_error());
      }
     
     
    if ($StatusCode == "0")
    {
    // Update database for successful transaction (status, stock etc)
    }
    else
    {
    // Update database for Failed transaction
    }
    */
    ?>
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    not sure how we're supposed to help you. Obviously you do know where to do the update, because you have a comment there. So is it a problem with the query syntax? A question about how exactly the query should work?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    2
    Originally Posted by Jacques1
    Hi,

    not sure how we're supposed to help you. Obviously you do know where to do the update, because you have a comment there. So is it a problem with the query syntax? A question about how exactly the query should work?
    yes its the actual syntax that i am unsure of

    thanks
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    The general syntax for a database update is:
    Code:
    UPDATE table SET column1 = value1 WHERE column2 = value2
    Where each word in lowercase would be replaced by something that reflects your actual database structure and variable values.

    Remember that string values must be surrounded by apostrophes, and all values must be passed through mysql_real_escape_string.

    column1 and value1 are respectively the column that you want to change and the value that you want to set the column to.

    columne2 and value2 are the column and value that uniquely identify the row that you want to update.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    ... or simply read the manual or one of the many, many tutorials.

    I mean, the syntax of (My)SQL isn't exactly secret knowledge.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    2
    Originally Posted by Jacques1
    ... or simply read the manual or one of the many, many tutorials.

    I mean, the syntax of (My)SQL isn't exactly secret knowledge.
    thanks for you input

IMN logo majestic logo threadwatch logo seochat tools logo