xml show php sintax error on while loop

Discussion in 'XML' started by macaela, Jan 17, 2011.

  1. macaela

    macaela

    Joined:
    Jan 17, 2011
    Messages:
    1
    i hi keep getting this error
    Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs on line 10

    which is this line driving me crazey help me please
    PHP:
    $xmlBody .= "<?xml-stylesheet type="text/xsl" href="books06.xsl"?>";
    i'm trying to create a while loop that queries from mysql database but its not working help please here's the full code

    PHP:
    <?php

    header
    ("Content-Type: text/xml"); //set the content type to xml
    // Initialize the xmlOutput variable
    $xmlBody '<?xml version="1.0" encoding="ISO-8859-1"?>';
    $xmlBody .= "<catalog>";
    $xmlBody .= "<?xml-stylesheet type="text/xsl" href="books06.xsl"?>";


    $xmlBody .= "

    // Connect to your MySQL database whatever way you like to here
    mysql_connect("
    localhost","root","") or die (mysql_error());
    mysql_select_db("
    admin") or die ("no database");
    // Execute the Query on the database to select items(20 in this example)
    $sql = mysql_query("SELECT FROM news ORDER BY news_date DESC LIMIT 020");
    while(
    $row = mysql_fetch_array($sql)){
        // Set DB variables into local variables for easier use
        
    $news_id = $row["news_id"];
        
    $subject = $row["subject"];
        
    $news_date = strftime("%%d, %Y", strtotime($row["news_date"]));
        
    $news_artical = $row["news_artical"];
        // Start filling the 
    $xmlBody variable with looping content here inside the while loop
        // It will loop through 20 items from the database and render into XML format

        
    $xmlBody .= '
        <cd>

        <title>' . 
    $news_id . '</title>
        <artist>' . 
    $subject . '</artist>
       <country>' . 
    $news_date . '</country>
       <company>' . 
    $description . '</company>

            </cd>';
    } // End while loop
    mysql_close(); // close the mysql database connection
    $xmlBody .= "</catalog>";
    echo 
    $xmlBody; // output the gallery data as XML file for flash
    ?>
    macaela, Jan 17, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. simon

    Sintax error

    simon, Sep 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    514
    =?Utf-8?B?S2F1c3Rhdi4=?=
    Sep 21, 2005
  2. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,212
    Tim Slattery
    Mar 30, 2005
  3. Uday Bidkar
    Replies:
    4
    Views:
    474
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Dec 12, 2006
  4. Rajive Narain
    Replies:
    0
    Views:
    1,542
    Rajive Narain
    Sep 18, 2009
  5. Isaac Won
    Replies:
    9
    Views:
    349
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page