Page 1 of 1

Parse Error : unexpected T_ENCAPSED_AND_WHITESPACE, expectin

Posted: Wed Jan 25, 2006 3:38 pm
by Maluendaster
I got this error :

unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

in this line

Code: Select all

echo "<td><a href=link?id=$result['ID_Prueba']>$result['Nombre']</a></td><td>$result['Url']</td><td>$result['Imagen']</td><tr>";
Anyone knows what's wrong???

thank you!

Posted: Wed Jan 25, 2006 4:55 pm
by John Cartwright
post the surrounding lines, that one does not appear to have any errors.

Personally, I escape all variables (generally because I use single quotes more often) but even with double quotes as well to promote readability

ie.

Code: Select all

echo "<td><a href=link?id=".$result['ID_Prueba'].">".$result['Nombre']."</a></td><td>".$result['Url']."</td><td>".$result['Imagen']."</td><tr>";

Posted: Wed Jan 25, 2006 5:28 pm
by Maluendaster
Jcart wrote:post the surrounding lines, that one does not appear to have any errors.

Personally, I escape all variables (generally because I use single quotes more often) but even with double quotes as well to promote readability

ie.

Code: Select all

echo "<td><a href=link?id=".$result['ID_Prueba'].">".$result['Nombre']."</a></td><td>".$result['Url']."</td><td>".$result['Imagen']."</td><tr>";
it worked!! but i still need to change some stuff... I hope i can make it on my own!

thanks so much!