parse error, unexpected ':'

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default parse error, unexpected ':'

    I have a code to parse feeds and i have a problem with a tag

    <itms:coverArt>

    i've tried to put a \ or to remove it from the php like this
    itms.':'.coverArt but then there is no data displaying.

    Has anyone any ideas?

    the code <img border="0" src='.$rs[itms:coverArt].' width="50">

    and it gets the content from a script using this

    var $itemtags = array('itms:artist','itms:album', 'link', 'author',
    'category', 'itms:albumLink','itms:coverArt','comments', 'enclosure',
    'guid', 'pubDate', 'source','itms:albumPrice');

    thanks
    Ragnar Guest

  2. Similar Questions and Discussions

    1. PHP Parse error: parse error, unexpected t_string
      Thanks for your advice. It was a painstaking exercise and highly frustrating not being able to start Live data. Peter Kamstra
    2. #25256 [Opn->Bgs]: Parse error: parse error, unexpected $ in ... on line 642
      ID: 25256 Updated by: iliaa@php.net Reported By: a dot schat at streamedge dot com -Status: Open +Status: ...
    3. #25256 [Bgs->Opn]: Parse error: parse error, unexpected $ in ... on line 642
      ID: 25256 User updated by: a dot schat at streamedge dot com Reported By: a dot schat at streamedge dot com -Status: ...
    4. #25256 [NEW]: Parse error: parse error, unexpected $ in ... on line 642
      From: a dot schat at streamedge dot com Operating system: Linux PHP version: 4.3.1 PHP Bug Type: Compile Failure Bug...
    5. parse error, unexpected T_STRING
      in the line "include(sign.php);" the file name should be in quotes; like include("sign.php"); hth Kurt Milligan sky2070 wrote:
  3. #2

    Default Re: parse error, unexpected ':'

    *** Ragnar wrote/escribió (Wed, 27 Oct 2004 13:05:48 +0200): 

    It's fine that you copy a code excerpt, but you should copy at least a
    complete sentence.

    Given that the complete code reads something like this:

    echo '<img border="0" src='.$rs[itms:coverArt].' width="50">';

    Arrays in PHP accept two types of indexes, integers or strings. E.G.

    echo $rs[0];
    echo $rs['bar'];
    $foo=0; echo $rs[$foo];
    $foo='bar'; echo $rs[$foo];
    define('foo', 0); echo $rs[$foo];
    define('foo', 'bar'); echo $rs[$foo];


    What's itms:coverArt supposed to be?


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --
    Alvaro Guest

  4. #3

    Default Re: parse error, unexpected ':'

    On 2004-10-27 13:51:08 +0200, Alvaro G Vicario
    <com> said:
     
    >
    > It's fine that you copy a code excerpt, but you should copy at least a
    > complete sentence.
    >
    > Given that the complete code reads something like this:
    >
    > echo '<img border="0" src='.$rs[itms:coverArt].' width="50">';
    >
    > Arrays in PHP accept two types of indexes, integers or strings. E.G.
    >
    > echo $rs[0];
    > echo $rs['bar'];
    > $foo=0; echo $rs[$foo];
    > $foo='bar'; echo $rs[$foo];
    > define('foo', 0); echo $rs[$foo];
    > define('foo', 'bar'); echo $rs[$foo];
    >
    >
    > What's itms:coverArt supposed to be?
    >
    >
    > -- -- Álvaro G. Vicario - Burgos, Spain
    > -- Thank you for not e-mailing me your questions
    > --
    >[/ref]

    itms:coverArt is from a rss feed but udually they are formatted like this
    <item>text</item> and not like this <item:stuff>text</item:stuff> and while
    using the latest it gives a parse error



    Ragnar Guest

  5. #4

    Default Re: parse error, unexpected ':'

    On 2004-10-27 13:51:08 +0200, Alvaro G Vicario
    <com> said:
     
    >
    > It's fine that you copy a code excerpt, but you should copy at least a
    > complete sentence.
    >
    > Given that the complete code reads something like this:
    >
    > echo '<img border="0" src='.$rs[itms:coverArt].' width="50">';
    >
    > Arrays in PHP accept two types of indexes, integers or strings. E.G.
    >
    > echo $rs[0];
    > echo $rs['bar'];
    > $foo=0; echo $rs[$foo];
    > $foo='bar'; echo $rs[$foo];
    > define('foo', 0); echo $rs[$foo];
    > define('foo', 'bar'); echo $rs[$foo];
    >
    >
    > What's itms:coverArt supposed to be?
    >
    >
    > -- -- Álvaro G. Vicario - Burgos, Spain
    > -- Thank you for not e-mailing me your questions
    > --
    >[/ref]

    itms:coverArt id from a rss feed and usually they use another format as
    <item>text</item> but this one uses <item:stuff>text</item:stuff> and using
    this gives a parse error.
    Ragnar Guest

  6. #5

    Default Re: parse error, unexpected ':'

    *** Alvaro G Vicario wrote/escribió (Wed, 27 Oct 2004 13:51:08 +0200): 

    Sorry, typo!

    define('foo', 0); echo $rs[foo];
    define('foo', 'bar'); echo $rs[foo];


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --
    Alvaro Guest

  7. #6

    Default Re: parse error, unexpected ':'

    *** Ragnar wrote/escribió (Wed, 27 Oct 2004 13:59:45 +0200): 

    RSS is not PHP. Just can't just place it within your code :-?


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --
    Alvaro Guest

  8. #7

    Default Re: parse error, unexpected ':'

    Ragnar wrote: 

    If you learned yourself to use quotes when accessing array keys, you
    wouldn't have this problem:

    NOT: $foo[key]
    BUT: $foo['key']

    NOT: $rs[itms:coverArt]
    BUT: $rs['itms:coverArt']

    Also read:

    http://nl3.php.net/manual/en/language.types.array.php#language.types.array.dont s


    JW



    Janwillem Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139