calling a stored postgres function from php

I have a function in postgres, and when I'm at the pg prompt, I just do:

SELECT zp('zc',10,20,90);
FETCH ALL FROM zc;

I'm wondering how to do this from php?

I thought I could just do:

$q = pg_query("SELECT zp('zc',10,20,90)");

But, how do I "fetch" from that query?

I'm still not entirely certain how to do this...

I tried

$q = pg_query("SELECT zp('zc',10,20,90)");
$f = pg_query("FETCH ALL FROM zc");
while($row = pg_fetch_array($f)) ...

and

while($row = pg_fetch_all($f)) ...

and

$q = pg_query("SELECT zp('zc',10,20,90);FETCH ALL FROM zc;")
while($frow = pg_fetch_array($q)) ...

and

$q = pg_query("SELECT zp('zc',10,20,90);FETCH ALL FROM zc;")
while($frow = pg_fetch_result($q, 'num1')) ...

That last one resulted in a memory size exhaustion.... help?
n00b0101Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
All Courses

From novice to tech pro — start learning today.