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. =)
Problem formatting MySQL query results as XML.
Moderator: General Moderators
Re: Problem formatting MySQL query results as XML.
I have a feeling that you are doing nothing wrong. The browser is just processing the xml tags as HTML so the tags are not being displayed. Try viewing the source of you browser, you may find that the tags are there.
Re: Problem formatting MySQL query results as XML.
If you want the output to display as XML, simple add this to the top of your PHP script.zephyr750 wrote:I have a feeling that you are doing nothing wrong. The browser is just processing the xml tags as HTML so the tags are not being displayed. Try viewing the source of you browser, you may find that the tags are there.
Code: Select all
header('Content-Type: text/xml');- pavanpuligandla
- Forum Contributor
- Posts: 130
- Joined: Thu Feb 07, 2008 8:25 am
- Location: Hyderabad, India
Re: Problem formatting MySQL query results as XML.
hii..
i think u need to include php xml parser to read those values and displaying them in xml format.
c this,. http://in.php.net/manual/en/book.xmlwriter.php
i think u need to include php xml parser to read those values and displaying them in xml format.
c this,. http://in.php.net/manual/en/book.xmlwriter.php