supermerc Posted February 23, 2009 Share Posted February 23, 2009 Hi I have a code that grabs information from a game using curl it grabs the action log from the vault that contains info like Blahaha was awarded to Someone etc. Then I have a code thats supposed to award points to the users based on the item that deposited or was awarded. My code works however I only want aps to be subtracted if the item was awarded by the user name "ServeD" This is my code <?php if($v[3] == 'Awarded' && $v[0] == 'ServeD') { $newaps = ($selaps['aps'] - $selitem['value']); }elseif($v[3] == 'Deposited') { $newaps = ($selaps['aps'] + $selitem['dvalue']); } ?> If i take away && $v[0] == 'ServeD' everything works fine but when its there It takes away 150 aps from everyone and does weird calculations. Anyone know whats up? Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/ Share on other sites More sharing options...
supermerc Posted February 23, 2009 Author Share Posted February 23, 2009 anyone? Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/#findComment-768923 Share on other sites More sharing options...
genericnumber1 Posted February 23, 2009 Share Posted February 23, 2009 There's nothing syntactically wrong with the code you've shown us, there isn't much we can do to help you. Try echoing $v[0] and $v[3] before the if statements so you're sure the variable values are as you expect them to be. Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/#findComment-768924 Share on other sites More sharing options...
supermerc Posted February 23, 2009 Author Share Posted February 23, 2009 Im getting right result Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/#findComment-768928 Share on other sites More sharing options...
genericnumber1 Posted February 23, 2009 Share Posted February 23, 2009 Perhaps you meant $newaps = ($selaps['aps'] + $selitem['value']); instead of $newaps = ($selaps['aps'] + $selitem['dvalue']); If that isn't what you meant be sure to add error_reporting(E_ALL) to the top of your code - maybe it can tell you what's going on. Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/#findComment-769478 Share on other sites More sharing options...
supermerc Posted February 24, 2009 Author Share Posted February 24, 2009 nope it was something else but i fixed it Link to comment https://forums.phpfreaks.com/topic/146461-solved-if-statement-problem/#findComment-769716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.