| From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
|---|---|
| To: | ko <ko(at)origo(dot)com(dot)tw> |
| Cc: | <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: select date range? |
| Date: | 2003-06-17 12:02:27 |
| Message-ID: | Pine.LNX.4.33.0306170600390.1572-100000@css120.ihs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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]."'"
| From | Date | Subject | |
|---|---|---|---|
| Next Message | scott.marlowe | 2003-06-17 12:08:43 | Re: Can the frontend get notifications from the postgres |
| Previous Message | Tony Simbine | 2003-06-17 11:28:16 | Re: help |