...

View Full Version : executing PHP within an XML document



jasonc310771
11-26-2008, 03:31 AM
unable to execute PHP within an XML document

i have added the following line to my .htaccess file...

AddType application/x-httpd-php .xml

and this is my code in the xml file...

it shows the following error...

Parse error: syntax error, unexpected T_STRING on line 1


what could i be doing wrong that causes this error?





<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?php
$owner = "Daniel";

include("dbconfigfile.php");
$xmls = @mysql_query("SELECT * FROM `photo_album_xmls` WHERE `owner` = '" . $owner . "'") or die(mysql_error());
?>
<images>
<?php
while($rows=@mysql_fetch_array($xmls)){
?>
<pic>
<image>http://www.domain.com/photos/<?php echo($rows[url]);?></image>
<caption><?php echo($rows[desc]);?></caption>
</pic>
<?php
}
?>
</images>

jasonc310771
11-26-2008, 04:13 AM
partly solved...

i changed the file from an XML to a PHP and placed all of the 'xml text' parts within echo commands.

oesxyl
11-26-2008, 04:44 PM
partly solved...

i changed the file from an XML to a PHP and placed all of the 'xml text' parts within echo commands.
php or server-side problem, not xml. Ask one of the moderators to move the thread if you want an answer.

regards

Alex Vincent
11-26-2008, 09:28 PM
Ah, yes, I'm very familiar with this problem. See this thread:
http://www.codingforums.com/showthread.php?t=115915



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum