Click to See Complete Forum and Search --> : PHP output to XML


CJD118118
06-03-2007, 05:14 PM
Using the following,

<html><head><xml version="1.0" encoding="ISO-8859-1">
</head>
<?
//connection ...

//check to see if username exists
$query = mysql_query("SELECT * FROM members");



//xml
$output = "<users>";

while ($result = mysql_fetch_array($query, MYSQL_ASSOC)) {
$output .= "<user><userid>".$result[memberid]."</userid><username>".$result[username]."</username></user>";
}


$output .= "<\users>";
print $output;
?>
</html>

The problem is the returned code has none of the brackets '<' '>' etc. for xml, it only returns the actual usernames and id's.

e.g. instead of returning '<username>bob</username>' it just returns 'bob'.

Is there something simple im missing here?

Thanks for any help.

nshiell
06-04-2007, 05:30 AM
view the source in your browser and check to see if has printed the brackets.

By the way:

<xml version="1.0" encoding="ISO-8859-1">
<html><head>
</head>