I tried editing one of my PHP scripts myself and I messed it up.
Specifically, lines 13/14:
" $query = “UPDATE bbuild set Status=‘0’ WHERE OrderID=‘$id’”;
mysql_query($query); "
Does not run properly any more when they use to. (not to mention the other stuff I added) All of the new code is after that line. Below is the script before/after my modifications. Can someone find the error?
Thanks in advance!
AFTER MY MODIFICATIONS
<?php
$dbname = "melennet_bbuild";
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
if(strstr($p->ipn_data['payment_status'], 'Completed')) {
$id = $p->ipn_data['custom'];
$rs = mysql_query("SELECT * FROM bbuild WHERE OrderID='{$id}'");
$order = mysql_fetch_assoc($rs);
if(isset($order['OrderID']))
{
$query = "UPDATE bbuild set Status='0' WHERE OrderID='$id'";
mysql_query($query);
if(isset($order['referral']))
{
$referral = $order['referral'];
$dupcheck = mysql_query("SELECT * FROM affiliate WHERE affiliateid='$referral'");
if(mysql_num_rows($dupcheck) != 0) {
$cost = $order['Cost'];
$row = mysql_fetch_array($dupcheck);
$sales = $row['sales'];
$paymentdue = $row['paymentdue'];
$paymentdue = round($paymentdue, 2);
$total = $row['total'];
$total = round($total, 2);
$email = $row['email'];
$percent = $row['percent'];
$sales++;
$paymentdue = $paymentdue + (($percent/100) * $cost);
$total = $total + (($percent/100) * $cost);
$query = "UPDATE affiliate SET sales='$sales', paymentdue='$paymentdue', total='$total' WHERE affiliateid='$referral'";
mysql_query($query);
$subject = "Congratulations! You Received a Backlink Build Referral.";
$message = "Login to http://www.backlink.com/resellseo/login.php for more details.";
$from = "affiliates@backlink.com";
$headers = "From: $from";
mail($email,$subject,$message,$headers);
}
}
$subject2 = "New Order!";
$message2 = "Login to http://www.backlink.com for more details.";
$from2 = "mike@melen.net";
$headers = "From: $from2";
mail(yasinta@yahoo.com,$subject2,$message2,$headers2);
}
}
switch($p->ipn_data['txn_type']){
case 'subscr_cancel':
// $query = "UPDATE bbuild set Status='0' WHERE OrderID='$id'";
// mysql_query($query);
// break;
case 'subscr_signup':
break;
case 'subscr_payment':
break;
}
?>
BEFORE MY MODIFICATIONS (THIS WORKED)
<?php
$dbname = "melennet_bbuild";
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
if(strstr($p->ipn_data['payment_status'], 'Completed')) {
$id = $p->ipn_data['custom'];
$rs = mysql_query("SELECT * FROM bbuild WHERE OrderID='{$id}'");
$order = mysql_fetch_assoc($rs);
if(isset($order['OrderID']))
{
$query = "UPDATE bbuild set Status='0' WHERE OrderID='$id'";
mysql_query($query);
// mail here
$body= "message";
mail($order['Email'],"subject",$body);
}
}
switch($p->ipn_data['txn_type']){
case 'subscr_cancel':
// $query = "UPDATE bbuild set Status='0' WHERE OrderID='$id'";
// mysql_query($query);
// break;
case 'subscr_signup':
break;
case 'subscr_payment':
break;
}
?>