Search Postgresql Archives

script not working in php

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

 



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

[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