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
;
');
$rows = array();
while($r = pg_fetch_assoc($result)) {
$rows[] = $r;
}
print json_encode(array_values(pg_fetch_all($result)));
can anyone explain whythis is happening?
thanks,
Rob