From: | Jean-Christophe Roux <jcxxr(at)yahoo(dot)com> |
---|---|
To: | Talha Khan <talha(dot)amjad(at)gmail(dot)com> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: function with array parameter |
Date: | 2006-11-08 21:30:22 |
Message-ID: | 20061108213022.62179.qmail@web35301.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hello,
Thanks for the answer but the resource connection is optional and in this script there is no ambiguity since there is only one connection. I added the connection to pg_query any way and the script still fails. I went through archives and saw that others had the same problem with using a PHP arrays as a parameter to a Postgresql function. I have not found a solution though; any thought?
----- Original Message ----
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
Sent: Wednesday, November 8, 2006 3:25:29 PM
Subject: Re: [PHP] function with array parameter
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 | Andy Shellam (Mailing Lists) | 2006-11-08 21:37:22 | Re: function with array parameter |
Previous Message | Steven Osborn | 2006-11-08 21:06:50 | unsubscribe |