Jump to content

[SOLVED] IF statement problem


supermerc

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.