The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-General - Update MYsql Database once results return from payment centre
Discuss Update MYsql Database once results return from payment centre in the PHP Development forum on Dev Shed. Update MYsql Database once results return from payment centre PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 7th, 2013, 05:37 AM
|
|
Contributing User
|
|
Join Date: Sep 2012
Posts: 67
Time spent in forums: 15 h 54 m 55 sec
Reputation Power: 1
|
|
|
PHP-General - 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
}
*/
?>
|

February 7th, 2013, 06:27 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|
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?
|

February 7th, 2013, 06:45 AM
|
|
Contributing User
|
|
Join Date: Sep 2012
Posts: 67
Time spent in forums: 15 h 54 m 55 sec
Reputation Power: 1
|
|
Quote: | 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
|

February 7th, 2013, 09:07 PM
|
 |
Lost in code
|
|
|
|
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.
|

February 8th, 2013, 04:09 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
... or simply read the manual or one of the many, many tutorials.
I mean, the syntax of (My)SQL isn't exactly secret knowledge.
|

February 8th, 2013, 05:25 AM
|
|
Contributing User
|
|
Join Date: Sep 2012
Posts: 67
Time spent in forums: 15 h 54 m 55 sec
Reputation Power: 1
|
|
Quote: | 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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|