Nested Query OK in psql but not in PHP

Поиск
Список
Период
Сортировка
Искать

Nested Query OK in psql but not in PHP

От:
rloef@interfold.com
Дата:
I have a nested query that runs fine in psql but does not return
tabular data in PHP. I have built the query a step at a time and it
works as expected, even in PHP up to the point where I include the
second query, which uses a concatted string of field data to provide
row identity. I'm quite the PHP newbie in mysql and even moreso with
postgresql. Is there something that changes in the PHP code that builds
the tabular display if a query is a nested query as opposed to it not
being a nested query? I get no errors in /var/log/messages so
_something_ thinks the query is OK. I'm just not seeing a populated
table; only the html-coded column headings.

I can include some actual cut-'n-paste, but I'd like to try and figure
at least some of this out myself first.


Regards,

r

Re: Nested Query OK in psql but not in PHP

От:
Martijn van Oosterhout <kleptog@svana.org>
Дата:
Вложения:
On Sun, Apr 30, 2006 at 03:52:29PM -0700, rloef@interfold.com wrote:
> ... Is there something that changes in the PHP code that builds
> the tabular display if a query is a nested query as opposed to it not
> being a nested query? 

PHP has no idea what a nested query is, let alone understanding SQL.
You must be doing something else wrong (quoting?).

> I can include some actual cut-'n-paste, but I'd like to try and figure
> at least some of this out myself first.

We can't help you at all without a cut-n-paste.

Have a nice day,
-- 
Martijn van Oosterhout      http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Re: Nested Query OK in psql but not in PHP

От:
Reed Loefgren <rloef@interfold.com>
Дата:
On Mon, 1 May 2006, Martijn van Oosterhout wrote:

> On Sun, Apr 30, 2006 at 03:52:29PM -0700, rloef@interfold.com wrote:
>> ... Is there something that changes in the PHP code that builds
>> the tabular display if a query is a nested query as opposed to it not
>> being a nested query?
>
> PHP has no idea what a nested query is, let alone understanding SQL.
> You must be doing something else wrong (quoting?).
>
>> I can include some actual cut-'n-paste, but I'd like to try and figure
>> at least some of this out myself first.
>
> We can't help you at all without a cut-n-paste.
>
> Have a nice day,
> -- 
> Martijn van Oosterhout      http://svana.org/kleptog/
>> From each according to his ability. To each according to his ability to litigate.

All,

It is fixed now and, yes, I was doing something wrong. In the query I 
referred to a field as s.fieldname, out of habit, to avoid issues with 
duplicate fieldnames in joined tables. But when I did the code for the 
tabular display  $myrow['s.fieldname'] it didn't want that. Dropping the 
tablename alias prepend did the trick. And now it's a nice day indeed.

thanks,

r
FAQ