Can you please help me with Parse error?

Discussion in 'PHP' started by Diffrence, Jul 2, 2010.

  1. #1
    Hello guys,
    Can you tell me what's wrong with this code:

    
    $pid = $row['PID'];
    $getthreadname = mysql_query("SELECT subject FROM vbulletin_posts WHERE pid = $pid");
     while($row2 = mysql_fetch_array($getthreadname))
    {
    $postname = $row2['subject'];
    echo "<a href="http://allianceforums.ws/forums/post-".$pid.".html#pid".$pid.">".$postname."</a>";
    }
    PHP:
    I'm reciving Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' and I can't really figure out why.

    Thanks in advance.
     
    Diffrence, Jul 2, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    
    $pid = $row['PID'];
    $getthreadname = mysql_query("SELECT subject FROM vbulletin_posts WHERE pid = $pid");
     while($row2 = mysql_fetch_array($getthreadname))
    {
    $postname = $row2['subject'];
    echo '<a href="http://allianceforums.ws/forums/post-".$pid.".html#pid".$pid.">".$postname."</a>';
    }
    
    PHP:
    Single quotes on your echo.
     
    MyVodaFone, Jul 2, 2010 IP
  3. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #3
    
    $pid = $row['PID'];
    $getthreadname = mysql_query("SELECT subject FROM vbulletin_posts WHERE pid = $pid");
     while($row2 = mysql_fetch_array($getthreadname))
    {
    $postname = $row2['subject'];
    echo sprintf('<a href="http://allianceforums.ws/forums/post-%s.html#pid%s">%s</a>', $pid, $pid, $postname);
    }
    
    PHP:
     
    gapz101, Jul 2, 2010 IP
  4. Diffrence

    Diffrence Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you very much!
     
    Diffrence, Jul 2, 2010 IP
  5. citrine

    citrine Greenhorn

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    I tried to move my domain from Godaddy to Bigcommerce and got this error-

    Parse error: syntax error, unexpected T_STRING in /home/leon2007/public_html/mysite.com/index.php on line 1

    Is there any php professional who would be able to help me fix this?
     
    citrine, Jul 18, 2010 IP
  6. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #6
    Post the contents of index.php here, it may be your using short php tags, and you need to use full php tags.
     
    danx10, Jul 18, 2010 IP
  7. citrine

    citrine Greenhorn

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    I am sorry if I sound dumb but I have no idea where to find index.php file. Is there a problem with my bigcommerce template?
     
    citrine, Jul 18, 2010 IP
  8. citrine

    citrine Greenhorn

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    Okie I found it-

    <?php
    /**
    * Front to the WordPress application. This file doesn't do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */

    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define('WP_USE_THEMES', true);

    /** Loads the WordPress Environment and Template */
    require('./wp-blog-header.php');
    ?>
     
    citrine, Jul 18, 2010 IP