echo "<head></head><div style='float:left; padding:30px'><h1>$k['Name']</h1></br><img src='sponsor/".$k['Pic'].'.jpeg'."' height='300' width='300'><br>.</hr></div>";

The error occured after i wanted to echo $k['Name'];

This is the error that it shows
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

Member Avatar
diafol

Either concatenate the first variable or use braces to surround it. Concatenation is such a mess

In any case, this is HTML code, not PHP. You can put HTML in PHP class member variables and then output them in one shot, and this error should not occur. Do remember you still need to express the HTML code properly in the PHP variable.

Member Avatar
diafol
echo "<head></head><div style='float:left; padding:30px'><h1>{$k['Name']}</h1></br><img src='sponsor/{$k['Pic']}.jpeg' height='300' width='300'><br></hr></div>";

Should work using braces. Use braces if you want to use array elements or class properties in strings but only if the string is enclosed in double quotes.