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:
Rodrigo
You have single quotes inside the query and the complete string is defined with single quotes too.....use double quotes to define the stringHi,
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 kwfrom 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 kwfrom energie.tennet_auswertung_pivot_energie ) z;');
Rodrigo