What your looking for is called heredoc.
For what it's worth, the SQL query is irrelevant to the string assignment:
$html = <<<HTML
Imagine some HTML here with interspersed $variables
HTML;
It's of course not limited to HTML either. It has quite a few useful properties for large blocks of text. Namely, you can interpolate variables into it in a pleasant manner, and you don't have to escape single or double quotes. (According to the manual: "Heredoc text behaves just like a double-quoted string, without the double quotes.")