Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 360voice.com
 XML/APIs
 Need help with a PHP loop
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Koding

249,303

Zone: Recreation

Total games played: 891

Current Streak: 549

Longest Streak: 813

Comments Made: 1,337

Moderator

USA
4900 Posts

Posted - Jul 04 2008 :  11:45:54 AM  Show Profile  Visit Koding's Homepage  Reply with Quote
OK, here's what I'm trying to do. I am trying to parse the blog-getentries XML that is displaying a user's info for all days in their current streak. The info I want is the the greatest gamerscore increase and the date during the streak.

I tried this first:
	for ($counter = 0; $counter < $profilexml->info->dayplayed; $counter++)
	{
		if ($daysplayedxml->blog->entry[$counter]->gsincrease > $biggestgsinc)
		{
			$biggestgsinc = $daysplayedxml->blog->entry[$counter]->gsincrease;
			$datebiggestgsinc = $daysplayedxml->blog->entry[$counter]->date;
		}
	}
$biggestgsinc has already been set to 0 and $profilexml->info->dayplayed is the number of days in the user's current streak.

Then I tried this:
	foreach ($daysplayedxml->blog->entry as $points)
	{	
		if ($points->gsincrease > $biggestgsinc)
		{
			$biggestgsinc = $points->gsincrease;
			$datebiggestgsinc = $points->date;
		}
	}
Neither way works and actually both give the same wrong answer. I'm sure it's something simple I'm overlooking so if anyone can give me a push in the right direction, I'd appreciate it.

My: | Kode360.com | Raptr | TrueAchievements | Xfire | Facebook | Twitter | GamerDNA |
| Game Stats: Forza Horizon | Saints Row The Third | Halo 4 | Battlefield 3 |
| Back when I was 360Voice Member of the Moment |
| I am a Level 6 Xbox Ambassador (<--- it's working again!!) |
Check out this new gaming site! ---> Gamer Jockies


Get your own sig bars like these at 360vui


Check out your 360voice User Info at Kode360.com!
(And join the 360vui Users Group!)

TX Eegras

22,426

Zone: Recreation

Total games played: 98

Current Streak: 0

Longest Streak: 51

Comments Made: 1,337

Senior Gamer

USA
994 Posts

Posted - Jul 04 2008 :  11:47:53 AM  Show Profile  Visit TX Eegras's Homepage  Reply with Quote
Try

for ($counter = 0; $counter <= intval($profilexml->info->dayplayed); $counter++)
	{
		if ($daysplayedxml->blog->entry[$counter]->gsincrease > $biggestgsinc)
		{
			$biggestgsinc = $daysplayedxml->blog->entry[$counter]->gsincrease;
			$datebiggestgsinc = $daysplayedxml->blog->entry[$counter]->date;
		}
	}

Go to Top of Page

Koding

249,303

Zone: Recreation

Total games played: 891

Current Streak: 549

Longest Streak: 813

Comments Made: 1,337

Moderator

USA
4900 Posts

Posted - Jul 04 2008 :  12:06:04 PM  Show Profile  Visit Koding's Homepage  Reply with Quote
Thanks for the help TX E. That was the right function, but in the wrong place. This now works:
	for ($counter = 0; $counter < $profilexml->info->dayplayed; $counter++)
	{
		if (intval($daysplayedxml->blog->entry[$counter]->gsincrease) > $biggestgsinc)
		{
			$biggestgsinc = intval($daysplayedxml->blog->entry[$counter]->gsincrease);
			$datebiggestgsinc = $daysplayedxml->blog->entry[$counter]->date;
		}
	}

My: | Kode360.com | Raptr | TrueAchievements | Xfire | Facebook | Twitter | GamerDNA |
| Game Stats: Forza Horizon | Saints Row The Third | Halo 4 | Battlefield 3 |
| Back when I was 360Voice Member of the Moment |
| I am a Level 6 Xbox Ambassador (<--- it's working again!!) |
Check out this new gaming site! ---> Gamer Jockies


Get your own sig bars like these at 360vui


Check out your 360voice User Info at Kode360.com!
(And join the 360vui Users Group!)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To:
360voice Community © 2006 360voice.com Go To Top Of Page
Snitz Forums 2000