Parse error: syntax error, unexpected 'items' (T_STRING)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjava
    New Member
    • Sep 2009
    • 132

    Parse error: syntax error, unexpected 'items' (T_STRING)

    hello,

    i have this error Parse error: syntax error, Parse error: syntax error, unexpected 'items' (T_STRING) when i execute my file php in the following my code :
    Code:
    <?php
       include_once("connect.php");
       mysql_select_db($dbname, $conn);
       $sql = "SELECT * FROM `jo_jomres_schedule_1`,'joM_1','joM_75','joM_76'";
    $db_items = mysql_query($sql);
    $xml = new DOMDocument('1.0', 'UTF-8');
    if (mysql_num_rows($db_items) != NULL){
    $items = $xml->createElement(« items »);
    while ($db_item = mysql_fetch_assoc($db_items)){
    $item = $xml->createElement(« item »);
    foreach($db_item as $key => $value){
    $node = $xml->createElement($key,$value);
    $item->appendChild($node);
    }
    $items->appendChild($item);
    }
    $xml->appendChild($items);
    }
    echo $xml->saveXML();
    ?>
    Thanks in advance
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    Please don't edit the error messages when you post them. The line numbers, and other such "trivia", are actually highly useful when debugging.

    As to the problem. The « items » on lines 8 and « item » 10 aren't valid PHP code. Did you copy this code from somewhere, without making sure it's valid? I'm guessing those weird arrow chars are supposed to be quote marks, and the extra white-spaces between them and the words aren't supposed to be there.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      I'm guessing those weird arrow chars are supposed to be quote marks, and the extra white-spaces between them and the words aren't supposed to be there.
      rather looks like placeholders to me (like <insert-name-of-desired-element-here>).

      Comment

      • ikhwan anshori
        New Member
        • May 2013
        • 2

        #4
        i'm read that, i agree with @Atli

        Comment

        Working...