<?PHP

$SQL = "SELECT * from CLIENTS WHERE UNI = '$item_number'";
$result = mysql_query( $SQL ); while( $row = mysql_fetch_array( $result ) ) {
$ig = $row["IG"];}
$newig = $ig + $price;

$month=date(m);
$day=date(d);
$year=date(Y);

$today  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m") , date("d"), date("Y")));
$month  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m")+1  , date("d"), date("Y")));
$quarter  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m")+3  , date("d"), date("Y")));
$semi  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m")+6  , date("d"), date("Y")));
$anually  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m")  , date("d"), date("Y")+1));
$twoyears  = strftime ("%B %d, %Y", mktime(0, 0, 0, date("m")  , date("d"), date("Y")+2));

if ($period3 == '1 M') {$next = $month;}else{}
if ($period3 == '3 M') {$next = $quarter;}else{}
if ($period3 == '6 M') {$next = $semi;}else{}
if ($period3 == '1 Y') {$next = $anually;}else{}
if ($period3 == '2 Y') {$next = $twoyears;}else{}

//-----------------------------------------
$sql = "UPDATE CLIENTS SET STATUS ='Active', IG ='$newig', LASTPAYMENT = '$today', NEXTPAYMENT='$next' WHERE UNI = '$item_number' AND PAYER_EMAIL = '$payer_email'";
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());

?>
