1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

help for syntax error, unexpected T_ECHO, expecting ',' or ';

Discussion in 'PHP' started by mike2011, Nov 14, 2010.

  1. #1
    I am having trouble with my function.php file. Please help!


    Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in site/wp-content/themes/theme/functions.php on line 31

    Line 31

    echo "143191220"echo $contentecho " [...]"$content=substr($content,0,$espacio)$espacio=strpos($content," ",$max_char)strlen;
     
    mike2011, Nov 14, 2010 IP
  2. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #2
    put a ; after echo "143191220" and echo $content
     
    srobona, Nov 14, 2010 IP
  3. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    you are not using the ";" anywhere in the code, after statements
    should be:
    echo "143191220";
    echo $content;
    echo " [...]";
    $content=substr($content,0,$espacio);
    $espacio=strpos($content," ",$max_char);

    ???strlen;???

    and so on...
     
    max2010, Nov 14, 2010 IP
  4. mike2011

    mike2011 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it worked but another error line 44 which is
    Parse error: syntax error, unexpected T_VARIABLE in

    42 function cat_id_to_name($id){
    43 $category
    44 $category
    45 function get_image($postid = 0,$size = "full"){
    46 $postid=get_the_ID();
    47 $thumb=get_post_meta($postid,"thumb");
    48 echo $thumb;
    49 while ($images=get_children()) {
     
    mike2011, Nov 14, 2010 IP
  5. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    these lines:
    $category
    $category
    PHP:
    when some word is starting with a $ means that is a variable
    if you start a line with a variable like $x, you should then assign a value
    example:

    $x=1;
    $category=1;
    PHP:
    a variable can have different types (integer, float, string and so on)
    for example if you write:

    $category="my category name";
    PHP:
    php will automatically know that this is a string

    in this line, for example:

    $thumb=get_post_meta($postid,"thumb");
    PHP:
    you are assigning to the variable $thumb what is returned by the function get_post_meta, giving those values ($postid, "thumb")

    then, many are php functions, many others can be custom functions
    for example get_post_meta seems a wordpress function, so I guess you are using wordpress

    anyway, you can't only write:

    $x
    PHP:
    or

    $category
    PHP:
    because it means nothing
     
    max2010, Nov 15, 2010 IP
  6. mike2011

    mike2011 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thank you but that didnt solved the problem need more information and yes i m using wordpress
     
    mike2011, Nov 16, 2010 IP
  7. mike2011

    mike2011 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    is any1 else could hep me with this problem ?
     
    mike2011, Nov 21, 2010 IP