Formatting GUI using PHP Server Script

Hey guys, having some difficulties here. I’m trying to make a level list on my game. I have it working pretty well but I can’t get a button to appear after each listing (to play the level). Here’s what my script looks like…

PHP:

for($i = 0; $i < $num_results; $i++)
    {
         $row = mysql_fetch_array($result);
         echo ("Level name: " . $row['lvlname'] . 
		 "

Level Description: " . $row[‘description’] .
"
Level Rating: " . $row[‘rating’] .
"
if(GUILayout.Button("Play!")) {
//Play Level
}

");
}

And in game, I have this script:

var lvl_get = WWW("http://www.coreymccown.com/Unity/BallGame/levellist.php");
yield lvl_get;
   
if(lvl_get.error) {
    print("There was an error getting the level list: " + lvl_get.error);
} else {
   LevelsText = lvl_get.text; // this is a GUIText that will display the level list
}

And my result is:
alt text
(Pardon my mild swearing, just entertaining my boring self.)

I dunno what to do! Any help is greatly appreciated! Thanks! :slight_smile:

If you like the JSON format, you might want to look into a JSON parser (just google unity and json, you’ll find it) In any case, you would just return the name, description, and rating. NOT CODE. Your code will take that returned text and parse it into some GUI elements, adding the button at that point.