That doesnt work actually. It just doesnt show the data for that one part of it.
I recoded the main part a bit maybe that will help.
Thanks for trying .
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="2" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Tag</font></th>
<th><font face="Arial, Helvetica, sans-serif">Online?</font></th>
<th><font face="Arial, Helvetica, sans-serif">Game</font></th>
<th><font face="Arial, Helvetica, sans-serif">URL</font></th>
<th><font face="Arial, Helvetica, sans-serif">Gamertag</font></th>
<th><font face="Arial, Helvetica, sans-serif">Add</font></th>
<th><font face="Arial, Helvetica, sans-serif">Send MSG</font></th>
</tr>
<?php
$hostname='----';
$username='-----';
$password='-----';
$dbname='------';
mysql_connect($hostname,$username,$password);
@mysql_select_db($dbname) or die( "Unable to select database");
$query="SELECT * FROM gamertags";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"first");
$i++;
$xml = simplexml_load_file("http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=".urlencode($f1));
{
foreach( $xml->PresenceInfo as $lvl1 )
{
$status = 'Status: '.$lvl1->Info.'<br />';
$online = 'Online/Offline: '.$lvl1->StatusText.'<br />';
$Game = 'Game: '.$lvl1->Title.'<br />';
$sex = 'Likes Sex: Yes'.'<br />';
}
}
{
foreach( $xml->Gamertag as $lvl2 )
{
$tag = 'Gamertag: '.$lvl2.'<br />';
}
}
{
foreach( $xml->ProfileUrl as $lvl3 )
{
$url = "<a href=\"$lvl3\">Profile url</a>".'<br />';
}
}
{
$add = ("<a href=\"http://live.xbox.com/profile/FriendsMgmt.aspx?gt=".urlencode($f1)."&act=Add\">Add as friend</a>".'<br />');
$msg = ("<a href=\"http://live.xbox.com/profile/MessageCenter/SendMessage.aspx?gt=".urlencode($f1)."\">$Send Message</a>".'<br />');
}
// Spot for styled data here
{
// echo $status,$online,$Game,$sex,$tag,$url,$add,$msg; ?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $status; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $online; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $Game; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $sex; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $tag; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $add; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $msg; ?></font></td>
</tr>
<?
}
}
?>
</table>
</body>
</html>