| From: | "Talha Khan" <talha(dot)amjad(at)gmail(dot)com> |
|---|---|
| To: | "Jean-Christophe Roux" <jcxxr(at)yahoo(dot)com> |
| Cc: | pgsql-php(at)postgresql(dot)org |
| Subject: | Re: function with array parameter |
| Date: | 2006-11-08 20:25:29 |
| Message-ID: | f80885fc0611081225h3ff97898n2afde937dc4067a3@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-php |
Hi Jean,
>>$result = pg_query($query);
try it as follows
$result=pg_query($database,$query);
where
$database=<database name>
Regards,
Talha Khan
On 11/9/06, Jean-Christophe Roux <jcxxr(at)yahoo(dot)com> wrote:
>
> Hello,
> I have a function that I would like to call from a php script:
>
> CREATE OR REPLACE FUNCTION a_dummy(arr_in text[])
> RETURNS text AS
> $BODY$
> declare
> begin
> return arr_in[1];
> end;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
>
> and the php code would be something like that
> $arr;
> $arr[0] = "one";
> $arr[1] = 'two';
> $query = "select func_a_dummy($arr)";
> $result = pg_query($query);
> echo pg_fetch_result($result, 0, 0);
>
>
> but the syntax is wrong. Any idea what I should do to make it work
> Thank you
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alan Hodgson | 2006-11-08 20:29:57 | Re: function with array parameter |
| Previous Message | Jean-Christophe Roux | 2006-11-08 20:07:23 | function with array parameter |