Page 1 of 1

unexpected T_ENCAPSED_AND_WHITESPACE?

Posted: Sat May 16, 2009 12:05 am
by rbroadwe

Code: Select all

 
if( $num_rows != 0 )
{
    while($row = mysql_fetch_array($result))
    {
        echo $row['time'] . " " . $row['ampm'];
        echo "&nbsp;<a href='schedule_now.php?appt_id=$row['appt_id']'>&nbsp;Schedule Now!&nbsp;</a>";
        echo "<br />";
    }
}
 
generates error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/robbroa1/public_html/thefixitfox/check_appt.php on line 261
row 261 corresponds to row 7.

I don't understand this... anyone have any ideas?

Thank you!

Re: unexpected T_ENCAPSED_AND_WHITESPACE?

Posted: Sat May 16, 2009 1:51 am
by Griven
Use concatenation in this case.

I don't know the precise reason why it's throwing the error, but I tested it out, and this line will work:

Code: Select all

echo "&nbsp;<a href='schedule_now.php?appt_id=". $row['appt_id'] ."'>&nbsp;Schedule Now!&nbsp;</a>";

Re: unexpected T_ENCAPSED_AND_WHITESPACE?

Posted: Sat May 16, 2009 11:37 am
by rbroadwe
fixed it. :D thank you!!!