Re: Select and order by question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




On May 3, 2006, at 12:12 PM, <operationsengineer1@xxxxxxxxx> <operationsengineer1@xxxxxxxxx> 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



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux