473,585 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Results in XML Format

Hello everyone,

I am trying to display the results of a query in XML format and cant
seem to get it to work. Has anyone had any trouble exporting PHP/MySQL
-> XML? I am using the following format:
File: xmlexport.php

<?php header("Content-Type: text/xml"); ?>
<?xml version"1.0"?>
<rss version="2.0">
<channel>

<?php
// Database Functions Here to Access Data
echo "<item>$iteminf ofromdb</item>";
?>

</channel>
</rss>
This is the basic format i am following. When I just put some plain
XML data in the file and try to access it through my web browser
nothing shows up either. Is there something about using the .php
extension as an XML file?

Thanks,
-Rick

Jul 17 '05 #1
8 11099
"HappyHourHotSp ots.com" <Ri*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hello everyone,

I am trying to display the results of a query in XML format and cant
seem to get it to work. Has anyone had any trouble exporting PHP/MySQL
-> XML? I am using the following format:
File: xmlexport.php

<?php header("Content-Type: text/xml"); ?>
<?xml version"1.0"?>
<rss version="2.0">
<channel>

<?php
// Database Functions Here to Access Data
echo "<item>$iteminf ofromdb</item>";
?>

</channel>
</rss>
This is the basic format i am following. When I just put some plain
XML data in the file and try to access it through my web browser
nothing shows up either. Is there something about using the .php
extension as an XML file?

Thanks,
-Rick


Linkage?
Jul 17 '05 #2
HappyHourHotSpo ts.com <Ri*********@gm ail.com> wrote:
File: xmlexport.php

<?php header("Content-Type: text/xml"); ?>
<?xml version"1.0"?>
<rss version="2.0"> [snip] </rss>
This is the basic format i am following. When I just put some plain
XML data in the file and try to access it through my web browser
nothing shows up either.


Define nothing shows up! You did look at the source and not at the
rendered version?
Jul 17 '05 #3
Yeah, the source shows only <html><body></body></html>.

Jul 17 '05 #4
HappyHourHotSpo ts.com <Ri*********@gm ail.com> wrote:
Yeah, the source shows only <html><body></body></html>.


Which aren't present in the show script, you shouldn't use IE to debug.

For proper debugging (withaout an actual debugger):
-error_reporting to the max (E_ALL for php4)
-use a client that doesn't mess with output (lynx -source, of a moz/fire*
with with a plugin, or even a packetsniffer)

Jul 17 '05 #5
HappyHourHotSpo ts.com wrote:
Hello everyone,

I am trying to display the results of a query in XML format and cant
seem to get it to work. Has anyone had any trouble exporting
PHP/MySQL
-> XML? I am using the following format:
File: xmlexport.php

<?php header("Content-Type: text/xml"); ?>
<?xml version"1.0"?>
<rss version="2.0">
<channel>

<?php
// Database Functions Here to Access Data
echo "<item>$iteminf ofromdb</item>";
?>

</channel>
</rss>
This is the basic format i am following. When I just put some plain
XML data in the file and try to access it through my web browser
nothing shows up either. Is there something about using the .php
extension as an XML file?

Thanks,
-Rick


It could be that your server has short_open_tag set to on and is having
problems with the xml declaration (the parser sees the <? part of <?xml
and attempts to parse the declaration as php).

If this is the problem, you can either set short_open_tag to 'off' (edit
php.ini or use ini_set() ) or echo / print / etc the xml declaration.

Nick

Jul 17 '05 #6
I was thinking that too, but I have short_open_tags set to off. I
remember seeing that when i was setting up my server so i left it off
just for this reason.

Jul 17 '05 #7
That was actually the show source output that i got from Firefox. Is
there some sort of trick to writing XML with PHP? I figured that if
the file extension ended in PHP it wouldnt matter as long as what was
outputted is in proper XML format.

Jul 17 '05 #8
OK, i changed all my echo()'s to print() instead and now that seems to
have worked but now I am getting an error that says "XML Parsing Error:
xml processing instruction not at start of external entity"

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
10516
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
6
17010
by: maricel | last post by:
Is there anybody out there who have any idea why EXPORT is relatively slower when putting the output file on a network drive - map drive from onother PC compared to putting it on my local PC drive (faster). Is there any workaround or tuning config that is available? Your help would be highly appreciated. maricel
2
11473
by: hikums | last post by:
Hello, If I export a file containing date field, export to "/james/j.txt" of DEL select a1,adate from a The date is represented in YYYY/MM/DD format as expected. Output I need is to be in "yyyymmdd" without delimiter. MODIFIED BY DATESISO option has a delimiter.
2
6636
by: jpodesta | last post by:
I am working on a trade processing project for my company. I would like to export a report directly to .csv format. I have looked all over in the groups for a way to do this. Appearently something that would seem to be fairly simple is not. I had mixed success dropping the report into excel but upon export is carried over the field headers...
5
3410
by: JHNielson | last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours. I am trying to export a set of files to my hard drive to then later be FTPd to a server. the file format should be "TITLE.yyyymmdd" where yymmdd is the date code for when the files are created. ...
1
5579
by: InvestorTrade | last post by:
Hi, I've been trying to export/import a table from a DB with Chinese_PRC_CI_AS collation, and I can't seem to get it working at all - the export seems rather simple, it is the import that is not working at all. I am using MSSQL 2000: The table (under a Chinese_PRC_CI_AS collation DB) is as follows:
1
5694
by: goal2007 | last post by:
' File: Test.rss Dim format as string = "Excel" Dim fileName as String = "C:\Export2.xls" Dim reportPath as String = "/TimeByEmployee" Public Sub Main() ' Prepare Render arguments Dim historyID as string = Nothing Dim deviceInfo as string = Nothing
5
3763
by: The Pipe | last post by:
Hello I have a table that I need to export to a .asc file format. I have had several attempts at getting this to work but with no luck. Basically the file would need to have every record displayed on a separate line - If you like a CrLF delimited file. The unfortunate thing is that the file is to be then imported into a third party piece of...
3
4535
by: hotflash | last post by:
Hi All, Instead of displaying the search results such as names, phones, etc... on the screen, is there a way to export this information into an EXCEL format using ASP? Please advise. Thanks for your help.
0
7835
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8195
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7947
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3831
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2340
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.