Problem formatting MySQL query results as XML.
Posted: Sun Nov 02, 2008 1:09 pm
Hi, I'm trying to communicate with MySQL using PHP.
Actually I was following this:
http://livedocs.adobe.com/flex/3/html/d ... tml#193905
And here are the problem lines:
//////////////////////////////////////////////////////////////////////////
while ( $User = mysql_fetch_object( $Result ) )
{
$Return .= "<user><userid>".$User->userid."</userid><username>".$User->username."</username><emailaddress>".$User->emailaddress."</emailaddress></user>";
}
$Return .= "</users>";
mysql_free_result( $Result );
print ($Return)
//////////////////////////////////////////////////////////////////////////
I tried populating my table with some values before hand. (like samplename, sampleemail, ...)
After I run this php script(I didn't even involve with Flex yet, that's why I post here), the browser show something like this:
"1samplenamesamplemail2samplename2samplemail2" (of course, without the quotes)
instead of something like this:
<user>
<userid>1</userid>
<username>samplename</username>
<emailaddress>sampleemail</emailaddress>
</user>"
<user>
<userid>2</userid>
<username>samplename2</username>
<emailaddress>sampleemail2</emailaddress>
</user>"
What did I do wrong?
Thank you in advance. =)
Actually I was following this:
http://livedocs.adobe.com/flex/3/html/d ... tml#193905
And here are the problem lines:
//////////////////////////////////////////////////////////////////////////
while ( $User = mysql_fetch_object( $Result ) )
{
$Return .= "<user><userid>".$User->userid."</userid><username>".$User->username."</username><emailaddress>".$User->emailaddress."</emailaddress></user>";
}
$Return .= "</users>";
mysql_free_result( $Result );
print ($Return)
//////////////////////////////////////////////////////////////////////////
I tried populating my table with some values before hand. (like samplename, sampleemail, ...)
After I run this php script(I didn't even involve with Flex yet, that's why I post here), the browser show something like this:
"1samplenamesamplemail2samplename2samplemail2" (of course, without the quotes)
instead of something like this:
<user>
<userid>1</userid>
<username>samplename</username>
<emailaddress>sampleemail</emailaddress>
</user>"
<user>
<userid>2</userid>
<username>samplename2</username>
<emailaddress>sampleemail2</emailaddress>
</user>"
What did I do wrong?
Thank you in advance. =)