I’m trying to figure out where this error comes in (I’m trying to output some HTML using PHP).
$newLI = "<li id = $row['\"id\"'] style=\"padding-right: 20px; display:inline; border-right: 1px gray solid; margin: 0px; color: white;\">";
Which ends up giving me:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /homepages/31/d346239161/htdocs/Bloominate/alpha/getProfileData.php on line 23
I can’t figure out where the parse error is :(.
You need to enclose $row[‘id’] in curly braces, like
{$row['id']}No other escaping is necessary on it, though it should be enclosed in single quotes for the HTML attribute:
id='{$row['id']}'So a complete answer using no string contatenation and double-quoting would be: