pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: ko <ko@origo.com.tw>
Cc: pgsql-sql@postgresql.org
Subject: Re: select date range?
Date: Tue, 17 Jun 2003 06:02:27 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com> (raw)
In-Reply-To: <02c101c3347c$1279d830$c9641cac@myko>

On Tue, 17 Jun 2003, ko wrote:

> Hi,
> 
> When I use sql statement to select the date range from $_POST value,It doesn't work.
> 
> -------------------------------------------
> "select * from mydatabase where mydate between '$_POST[start_date]' and '$_POST[end_date]' "
> 
> There is no error,but the result is not I want.
> 
> ps:
> (1)mydate attribute is timestamp
> (2)$_POST[start_date] is something like '2003/05/12'

You may be having problems with how PHP interprets (or more correctly, 
doesn't) arrays inside of strings.  the problem is that inside of a string 
the autointerpretation of a string won't work for arrays, only simple 
scalars.

Change your string to this:

"select * from mydatabase where mydate between '".$_POST[start_date]."' and '".$_POST[end_date]."'"




view thread (4+ messages)

Message-ID: <Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@ihs.com, ko@origo.com.tw
  Subject: Re: select date range?
  In-Reply-To: <Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox