ViciousC Posted December 20, 2007 Share Posted December 20, 2007 Basically C=A+B If A=5 and B=5 then C=10. After C=10 then I want A=0 and B dont change. Trying to update the database wont let A=0 at the same time A=5 Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/ Share on other sites More sharing options...
rajivgonsalves Posted December 20, 2007 Share Posted December 20, 2007 what is the update statement ? Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419305 Share on other sites More sharing options...
ViciousC Posted December 20, 2007 Author Share Posted December 20, 2007 Kinda got this I know its wrong by far: $newamount = $userrow["case"] + $userrow["i14"]; $newamount2 = $userrow["i14"]-0; $updatequery = doquery("UPDATE {{table}} SET case='$newamount', i14='$newamount2' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419308 Share on other sites More sharing options...
rajivgonsalves Posted December 20, 2007 Share Posted December 20, 2007 can't make sense of your code but whats "-0" that will not do anything at all Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419310 Share on other sites More sharing options...
btherl Posted December 20, 2007 Share Posted December 20, 2007 "-0" will cast a value to an integer. In this case I don't see any need to do that.. Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419312 Share on other sites More sharing options...
ViciousC Posted December 20, 2007 Author Share Posted December 20, 2007 Wrote it wrong sorry $newamount = $userrow["case"] + $userrow["i14"]; $newamount2 = $userrow["i14"] - $newamount; $updatequery = doquery("UPDATE {{table}} SET case='$newamount', i14='$newamount2' WHERE id='".$userrow["id"]."' LIMIT 1", "users"); Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419315 Share on other sites More sharing options...
ViciousC Posted December 20, 2007 Author Share Posted December 20, 2007 Nevermind once i fixed my typo it wroks fine. Thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/82487-solved-lost-take-from-one-give-to-another/#findComment-419318 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.