Search Postgresql Archives

Re: script not working in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks....simple but important!


Von: Rodrigo Gonzalez <rjgonzale@xxxxxxxxxxxxxx>
An: Robert Buckley <robertdbuckley@xxxxxxxxx>
Cc: "pgsql-general@xxxxxxxxxxxxxx" <pgsql-general@xxxxxxxxxxxxxx>
Gesendet: 14:39 Donnerstag, 6.Oktober 2011
Betreff: Re: script not working in php

On 10/06/2011 09:22 AM, Robert Buckley wrote:
Hi,

this works ok in pgadmin3

select name[i], kw[i]
from ( select generate_series(1,6) as i, 
              array['Biomasse', 'Deponiegas', 'Solar', 'Wasser', 'Wind','GESAMT'] as name, 
              array[biomasse_kw, deponiegas_kw, solar_kw,wasser_kw, wind_kw, kw] as kw
       from energie.tennet_auswertung_pivot_energie ) z
;

but in the php script I get error 500?


$result = pg_query($connection,'
select name[i], kw[i]
from ( select generate_series(1,6) as i, 
              array['Biomasse', 'Deponiegas', 'Solar', 'Wasser', 'Wind','GESAMT'] as name, 
              array[biomasse_kw, deponiegas_kw, solar_kw,wasser_kw, wind_kw, kw] as kw
       from energie.tennet_auswertung_pivot_energie ) z
;
');
You have single quotes inside the query and the complete string is defined with single quotes too.....use double quotes to define the string

Rodrigo



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux