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 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 ? 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"); 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 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.. 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"); 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 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
Archived
This topic is now archived and is closed to further replies.