Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    478
    Thanks
    3
    Thanked 0 Times in 0 Posts

    executing PHP within an XML document

    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?



    Code:
    <?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>

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    478
    Thanks
    3
    Thanked 0 Times in 0 Posts
    partly solved...

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

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by jasonc310771 View Post
    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

  • #4
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,461
    Thanks
    1
    Thanked 23 Times in 21 Posts
    Ah, yes, I'm very familiar with this problem. See this thread:
    http://www.codingforums.com/showthread.php?t=115915
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •