Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Select and order by question




On May 3, 2006, at 12:12 PM, <operationsengineer1(at)yahoo(dot)com> <operationsengineer1(at)yahoo(dot)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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group