Can someone tell me what this means?

Discussion in 'PHP' started by fredg61, Jun 17, 2008.

  1. #1
    I get this message when I click on the article page on my site:

    http://www.digitalcamera101.info/articles.php

    Parse error: syntax error, unexpected T_STRING in /home/besto18/public_html/digitalcamera101/articles.php on line 197

    Here are lines 192 thur 203:

    if (isset($rss_channel["ITEMS"])) {
    if (count($rss_channel["ITEMS"]) > 0) {
    for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
    if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
    echo ("\n<div class="itemtitle"><a target=_blank href="" _wpro_href=""
    _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" . $rss_channel["ITEMS"][$i]["LINK"] . "">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
    } else { <--------------------------------------------------------Line 197
    echo ("\n<div class=/"itemtitle/">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
    }
    echo ("<div class=/"itemdescription"/>" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />"); }
    } else {
    echo ("No News Found");
    }
     
    fredg61, Jun 17, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    in the line above 197, you have
    echo ("stuff here");

    where i have the "stuff herE", you have content with " 's in it, you need to change them to ' 's
     
    crath, Jun 17, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    addslashes? :D
     
    EricBruggema, Jun 18, 2008 IP
  4. fredg61

    fredg61 Well-Known Member

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    Thanks. Where do I add the slashes?
     
    fredg61, Jun 18, 2008 IP
  5. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #5
    Think he was referring to the addslashes function. Dunno.
    But to answer your question... if you use " as the delimiter, it has to be escaped...
    $string = "this is a quote \" quote \" and that's ok";

    same goes for if you used ' as the delimiter...
    $string = 'this is a quote "quote" but the quotation\'s fine';

    So why don't we just use the 's? Variables. if you put
    $variable = "red";
    $string = "text $variable text";
    would print text red text

    Alls fine. If you use '.
    $string = 'text $variable text';
    would print text $variable text

    HTH
     
    shallowink, Jun 18, 2008 IP
  6. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #6
    the slash shd be like this \ not like this /

    echo ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");


    similarly replace this
    echo ("\n<div class="itemtitle"><a target=_blank href="" _wpro_href=""
    _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" . $rss_channel["ITEMS"][$i]["LINK"] . "">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");

    with

    echo ("\n<div class=\"itemtitle\"><a target=_blank href=\"\" _wpro_href=\"\"
    _wpro_href=\"\" _wpro_href=\"\" _wpro_href=\"\" _wpro_href=\"\" _wpro_href=\"\" _wpro_href=\"\" _wpro_href=\"\" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" _wpro_href="" . $rss_channel["ITEMS"][$i]["LINK"] . "">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></div>");
     
    kmap, Jun 18, 2008 IP