The primary flaw in Haggi's code in all three of the above posts is that of scope. The variables $teamA and $teamB only exist within the printLogo() and printName() functions, not outside of them! Therefore Haggi's code, which exists outside of these functions, tries to use the content of these variables and fails to work.

Additionally, all of the functions in the snipped down set of code (snipped down to show only stuff related to Haggis's code), with the exception of getLogo(), expect to be given a copy of the $data variable, which holds the entire row of data from the database (as an "array"), while Haggis's code is incorrectly trying to give them a variable containing only a team name.

Hence why the HTML in your test page only contains <img src="images/.png"></img> instead of something like <img src="images/brisbane broncos.png"></img>, it's unable to get the name of the team due to incorrect use of the functions your developer created.

This makes the printLogo() function redundant btw. The whole purpose of the printLogo() function is to generate a snippit of HTML code to display a logo, but this replaces that, so you can get rid of it.

What is happening here (assuming the OP needs it explaining), is we are calling the getTeamA() and getTeamB() functions respectively, passing in the entire $data variable, as they expect. These functions return the team name from the $data variable. This return value is then given to getLogo() which puts together and returns the url for the image file.

Most of what theblazingangel said is correct, but the final product he gave you is not... There were definitely some redundancies in the code and it was far from professionally done, but the image name still needs echoed out. You only return data that you want echoed out when you are calling the function from within an echo statement: