Re: E_PARSE error ?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: PJ <af(dot)gourmet(at)videotron(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: E_PARSE error ?
Date: 2008-06-09 23:00:41
Message-ID: dcc563d10806091600v359f95d2uba1799dca55a660a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 3, 2008 at 10:14 AM, PJ <af(dot)gourmet(at)videotron(dot)ca> wrote:
> I'm using php5, postgresql 8.3, apache2.2.8, FreeBSD 7.0
> I don't understand the message:
>
> *Parse error*: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
> T_STRING or T_VARIABLE or T_NUM_STRING
>
> the guilty line is:
>
> list($page_id)=sqlget("
> select page_id from pages where name='$_SERVER['SCRIPT_NAME']'");

Inside quotes, you need to remove the single quotes around your array
index. Seems wrong, I know, but that's what php says to do. I prefer
to concatenate. so either:

list($page_id)=sqlget("select page_id from pages where
name='$_SERVER[SCRIPT_NAME]'");

list($page_id)=sqlget("select page_id from pages where
name=".$_SERVER['SCRIPT_NAME'].");

are legal.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2008-06-10 00:59:53 Re: Bottom Posting
Previous Message Tom Lane 2008-06-09 22:59:46 Re: pg_dump, COPY and inheritance