[suspicious - maybe spam] Using heredocs
| From: | Tim Burgan | Date: | Fri, 21 Jan 2005 14:10:37 +0000 |
| Subject: | [suspicious - maybe spam] Using heredocs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-206931@lists.php.net to get a copy of this message | ||
Hello,
I've just tried using heredocs [1] for the first time, but I am
receiving parse errors always on the very last line of my document.
The error is caused by my heredocs. Am I using it correctly? When I
replaced the heredoc with a string.. everything worked again.
Here's my code with heredocs (and the lines before and after for context):
/* Query the database */
$db_sql = <<<SQL
SELECT id, expiry, permissions
FROM tblStudents
UNION ALL
SELECT id, expiry, permissions
FROM tblStaff;
SQL;$rs = $db_connection->execute($db_sql); Here's my code without heredocs (and the lines before and after for context) - this works fine: /* Query the database */ $db_sql = 'SELECT id, expiry, permissions FROM tblStudents UNION ALL SELECT id, expiry, permissions FROM tblStaff;'; $rs = $db_connection->execute($db_sql); What am I doing wrong? Are there any requirements to using heredocs? I'm using PHP4, Apache, Win XP. [1] <http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc> Thanks Tim