ipwnzphp Posted July 28, 2008 Share Posted July 28, 2008 $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? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 28, 2008 Share Posted July 28, 2008 http://us.php.net/manual/en/function.time.php probably will explain things. Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 what dose time half to do with math? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 28, 2008 Share Posted July 28, 2008 time = unix time stamp = a number not what u think it is probably Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 umm? could you show some code? Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted July 28, 2008 Share Posted July 28, 2008 the time() function, returns the seconds since some date a long time ago. I think it was January 1st, 1960, or something like that. Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 but im not dealing with dates here im dealing with $$$ Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 28, 2008 Share Posted July 28, 2008 http://en.wikipedia.org/wiki/Unix_epoch Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 28, 2008 Share Posted July 28, 2008 well you have the line setcookie("vouch_price", $amount, time()+(60*60*24*5), "/", ""); but I see that is setting a cookie length time Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 i am setting the $$ in the cookie Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 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? Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 $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. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 28, 2008 Share Posted July 28, 2008 Doesn't that mean it's working? O_O Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 it dosent work right Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 it dosent work right 155 less 35 equals 120. Its pretty simple. Quote Link to comment Share on other sites More sharing options...
ipwnzphp Posted July 28, 2008 Author Share Posted July 28, 2008 yea i know that but it should say 0.00 this is a gift card coupon Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2008 Share Posted July 28, 2008 Your not making sense. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 28, 2008 Share Posted July 28, 2008 Having set a cookie value, the value of that cookie is not available until the the next page load. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.