On May 3, 2006, at 12:12 PM, <operationsengineer1@yahoo.com>
<operationsengineer1@yahoo.com> wrote:
> off topic, but still relevant to php sql. i'll share
> something that has made my life much easier wrt sql
> statements - heredocs.
>
> the format looks like this:
>
> $sSql = <<<_ESQL
>
> SELECT * FROM crm_events
> WHERE crm_leads_id
> IN (SELECT id FROM crm_leads)
> AND follow_up_action!=''
> ORDER BY follow_up_date asc limit 1
>
> _ESQL
A little shameless promotion: pgEdit will even color the heredoc
string for SQL if you start your heredoc string with <<<sql. Works
for <<<html also.
I'll have a short article out soon that shows how you can pretty much
remove all SQL from your PHP code using a simple PHP class and
PostgreSQL functions.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL