in reply to Re^2: $foo = << "END"
in thread $foo = << "END"

I previously advised you to read and understand How do I post a question effectively? which mentions updating your posts. Generally it's very helpful to add a line to point out what has been updated, e.g.

My first question goes here....

Update: I've thought of something else

Incidentally the code to post this is as follows:

<p>My first question goes here....</p> <p><b>Update</b>: I've thought of something else</p>

Again, going back to advice given in a previous thread, you need to ask questions properly. Tell people what you're actually trying to do.

It seems you're trying to build up a SQL statement based on a template query and some values stored in variables. I'd advise against using here docs to build up SQL queries based on appending values to strings. See Placeholders and bind variables and SQL_injection.