Jump to content

Math not working right.


ipwnzphp

Recommended Posts

$balanc = mysql_query("SELECT * FROM `jos_vm_vouchers` WHERE voucher_number = '$cop_code'") or die (mysql_error());
$balan = mysql_fetch_array($balanc);

$amount = $balan['voucher_value'];

setcookie("vouch_price", $amount, time()+(60*60*24*5), "/", "");

echo $_COOKIE['vouch_price'];

if (isset($_COOKIE['vouch_price'])) {
$order_total = $_COOKIE['vouch_price'] - $total;
} else {
$order_total += $shipping_total + $total;
}

 

say the cookie is 155 and the price is 35 well. the amount is coming back as 120 but it should come back as 0 why is it not working?

 

Link to comment
Share on other sites

say the cookie is 155 and the price is 35 well. the amount is coming back as 120 but it should come back as 0 why is it not working?

 

Sorry, but none of that makes any sense. Your problem is actually?

Link to comment
Share on other sites

$amount = "155";

// Cookie = 155
setcookie("vouch_price", $amount, time()+(60*60*24*5), "/", "");

if (isset($_COOKIE['vouch_price'])) {
$order_total = $_COOKIE['vouch_price'] - $total;
} else {
$order_total += $shipping_total + $total;
}

 

the price of $total = 35 the price of the cookie = 155 now when it comes back it says 120 insted of saying 0.00 for the total of the order.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.