Parse error: syntax error, unexpected T_VARIABLE. Need Help

Discussion in 'PHP' started by DragonIroh, Dec 2, 2011.

  1. #1
    Ok, I've been trying to retrieve information from a MYSQL database using PHP and I've come across this error.

    "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /usr/local/www/php/dbtest/index.php on line 17"
    Here is the part of the code in question.

    <?php
    while($output_row = mysql_fetch_array($result)) 
    {
        echo '<p>'.$output_row["VM_NAME"].', '$output_row["VM_STRING"].'</p>'; // Problem line
    }
    ?>
    PHP:
    I'm completely stumped cause the code to me looks fine, so perhaps one of you may have the answer.
     
    Solved! View solution.
    DragonIroh, Dec 2, 2011 IP
  2. #2
    Try this:

    <?php
    while($output_row = mysql_fetch_array($result))
    {
        echo '<p>'.$output_row["VM_NAME"].', '.$output_row["VM_STRING"].'</p>';
    }
    ?>
    PHP:
     
    mfscripts, Dec 2, 2011 IP
  3. DragonIroh

    DragonIroh Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That did the trick.
     
    DragonIroh, Dec 2, 2011 IP