should this PHP if else statement work
Posted: Mon Oct 12, 2015 8:24 am
I have a if else statement below based on if a certain variable is passed from an IPN . i would just test it but the site is live and wanted a heads up before i upload it.
i want if the $custom is empty to run the first statement if it is not empty run the second statement
i want if the $custom is empty to run the first statement if it is not empty run the second statement
Code: Select all
$itemNumber = $_POST['item_number'];
$paymentStatus = $_POST['payment_status'];
$payerStatus = $_POST['payer_status'];
$pendingReason = $_POST['pending_reason'];
$txnID = $_POST['txn_id'];
$receiverEmail = $_POST['receiver_email'];
$custom = $_POST['custom'];
if ($custom == "")
{
// update orders table
if ($itemNumber != "" && $txnID != "" && $paymentStatus != "") {
mysql_select_db($database_sweep, $sweep);
$IPN_upd = "UPDATE sweep_orders SET Fulfilled = " . $status . ", TransactID = '" . $txnID . "', TransactResult = '" . $paymentStatus . "', ResponseMsg = '" . $errmsg . "' WHERE OrderID = " . $itemNumber ;
$IPN_rsId = mysql_query($IPN_upd, $sweep) or die(mysql_error());
$IPN_rsId = null;
}
} else {
// update orders table
if ($custom != "" && $txnID != "" && $paymentStatus != "") {
mysql_select_db($database_sweep, $sweep);
$IPN_upd = "UPDATE sweep_orders SET Fulfilled = " . $status . ", TransactID = '" . $txnID . "', TransactResult = '" . $paymentStatus . "', ResponseMsg = '" . $errmsg . "' WHERE OrderID = " . $custom ;
$IPN_rsId = mysql_query($IPN_upd, $sweep) or die(mysql_error());
$IPN_rsId = null;
}
}