You are here: Re: [suspicious - maybe spam] Using heredocs « PHP « IT news, forums, messages
Re: [suspicious - maybe spam] Using heredocs

Posted by Jason Barnett on 01/21/05 16:53

Tim Burgan wrote:
> 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;
>

Heredoc is a strict format. the SQL; *must* be at the very beginning of
the line, so if you simply remove the whitespace before it you should be
fine.

> SQL;

SQL;

> $rs = $db_connection->execute($db_sql);
>
>
....
>
>
> Thanks
> Tim


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация