Help linking JSON and php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ron50000
Forum Newbie
Posts: 2
Joined: Tue May 04, 2010 6:15 pm

Help linking JSON and php

Post by ron50000 »

Hello i am working on a android application where it will read the Json(rss feed) from my site and display icons and scores. all the code works its just for any baseball team with two name such as new york yankees the icon will not display you can see the results here: http://www.mandarich.com/mandarichServe ... seball.php im not sure how to do the php to where teams NNY, SLT, NYM, LAD, LAA, CHC and anyteam that has a name space name. Here is the php code i had

Code: Select all

<?php
	$teams["boston"] = "bostonredsox.gif";
	$teams["nyyankees"] = "nyyankees.gif";
	$teams["baltimore"] = "baltimoreorioles.gif";
	$teams["tampa"] = "tampabayrays.gif";
	$teams["toronto"] = "torontobluejays.gif";
	$teams["atlanta"] = "atlantabraves.gif";
	$teams["florida"] = "floridamarlins.gif";
	$teams["nymets"] = "newyorkmets.gif";
	$teams["philadelphia"] = "philadelphiaphillies.gif";
	$teams["washington"] = "washingtonnationals.gif";
	$teams["chicagosox"] = "chicagowhitesox.gif";
	$teams["cleveland"] = "clevelandindians.gif";	
	$teams["detroit"] = "detroittigers.gif";
	$teams["kansas"] = "kansascityroyals.gif";
	$teams["minnesota"] = "minnesotatwins.gif";
	$teams["chicagocubs"] = "chicagocubs.gif";
	$teams["cincinnati"] = "cinncinatireds.gif";
	$teams["houston"] = "houstonastros.gif";
	$teams["milwaukee"] = "milwaukeebrewers.gif";
	$teams["pittsburgh"] = "pitsburghpirates.gif";
	$teams["St.Louis"] = "stlouiscardinals.gif";
	$teams["LaAngels"] = "losangelesangels.gif";
	$teams["oakland"] = "oaklandathletics.gif";
	$teams["seattle"] = "seattlemariners.gif";
	$teams["texas"] = "texasrangers.gif";
	$teams["arizona"] = "arizonadiamondbacks.gif";
	$teams["colorado"] = "coloradorockies.gif";
	$teams["ladodgers"] = "losangelesdodgers.gif";
	$teams["sandiego"] = "sandiegopadres.gif";
	$teams["sanfrancisco"] = "sanfranciscogiants.gif";

	
	$abbr["arizona"] = "ARI";
	$abbr["oakland"] = "OAK";
	$abbr["baltimore"] = "BAL";
	$abbr["tampa"] = "TAM";
	$abbr["boston"] = "BOS";
	$abbr["nyyankees"] = "NYY";
	$abbr["texas"] = "TEX";
	$abbr["toronto"] = "TOR";
	$abbr["LaAngels"] = "LAA";
	$abbr["atlanta"] = "ALT";
	$abbr["colorado"] = "COL";
	$abbr["philadelphia"] = "PHI";	
	$abbr["florida"] = "FLA";
	$abbr["milwaukee"] = "MIL";
	$abbr["washington"] = "WAS";
	$abbr["chicagosox"] = "CHW";
	$abbr["cleveland"] = "CLE";
	$abbr["detroit"] = "DET";
	$abbr["seattle"] = "SEA";
	$abbr["sanfrancisco"] = "SFO";
	$abbr["St.Louis"] = "STL";
	$abbr["chicagocubs"] = "CHC";
	$abbr["houston"] = "HOU";
	$abbr["nymets"] = "NYM";
	$abbr["cincinnati"] = "CIN";
	$abbr["sandiego"] = "SDG";
	$abbr["ladodgers"] = "LAD";
	$abbr["pittsburgh"] = "PIT";
	$abbr["minnesota"] = "MIN";
	$abbr["kansas"] = "KAN";
?>
Last edited by ron50000 on Wed May 05, 2010 11:52 am, edited 1 time in total.
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: Help linking RSS and php

Post by jraede »

Looks to me like it's a problem with whatever you're sending to that PHP file, rather than with the PHP itself. Where are those arrays used/implemented?
ron50000
Forum Newbie
Posts: 2
Joined: Tue May 04, 2010 6:15 pm

Re: Help linking RSS and php

Post by ron50000 »

The code is being implements into a android application for the droid phone. it shows the icons for team with one name such as baltimore but when comes to the two city names such as New York is doesnt.
Post Reply