Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 389389FB26B for ; Wed, 8 Nov 2006 16:07:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 83574-05 for ; Wed, 8 Nov 2006 16:07:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web35311.mail.mud.yahoo.com (web35311.mail.mud.yahoo.com [66.163.179.105]) by postgresql.org (Postfix) with SMTP id 4AE749F9858 for ; Wed, 8 Nov 2006 16:07:27 -0400 (AST) Received: (qmail 43285 invoked by uid 60001); 8 Nov 2006 20:07:24 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type; b=Zh9LPRx2QR9IBj7guScV7QT0mP/dvjvd16FZFZitcaJD6xEVBAAHqlNVFmmc3NqhkRZtJw3vJpWyYBYk510HILJKWe3BxB67QK8/xnmzIGu0NwTNUTcPm4vIZlCc6NMroSz8zvRaen8Rbs3oZY40+AbzCj81nyAp7jlXU1CFmWs= ; Message-ID: <20061108200724.43283.qmail@web35311.mail.mud.yahoo.com> Received: from [74.98.189.48] by web35311.mail.mud.yahoo.com via HTTP; Wed, 08 Nov 2006 12:07:24 PST Date: Wed, 8 Nov 2006 12:07:23 -0800 (PST) From: Jean-Christophe Roux Subject: function with array parameter To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2016155230-1163016443=:43259" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.131 tagged_above=0 required=5 tests=BAYES_00, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_30_40, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200611/19 X-Sequence-Number: 3636 --0-2016155230-1163016443=:43259 Content-Type: text/plain; charset=ascii Content-Transfer-Encoding: quoted-printable Hello,=0AI have a function that I would like to call from a php script:=0A= =0ACREATE OR REPLACE FUNCTION a_dummy(arr_in text[])=0A RETURNS text AS=0A= $BODY$=0Adeclare=0Abegin=0A return arr_in[1];=0Aend;=0A$BODY$=0A LANGUA= GE 'plpgsql' VOLATILE;=0A=0Aand the php code would be something like that= =0A$arr;=0A$arr[0] =3D "one";=0A$arr[1] =3D 'two';=0A$query =3D "select fun= c_a_dummy($arr)";=0A$result =3D pg_query($query);=0Aecho pg_fetch_result($r= esult, 0, 0);=0A=0A=0Abut the syntax is wrong. Any idea what I should do to= make it work=0AThank you=0A=0A=0A=0A --0-2016155230-1163016443=:43259 Content-Type: text/html; charset=ascii Content-Transfer-Encoding: quoted-printable
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
  &nb= sp; return arr_in[1];
end;
$BODY$
  LANGUAGE 'plpgsql' VOLATI= LE;

and the php code would be something like that
$arr;
$arr[0= ] =3D "one";
$arr[1] =3D 'two';
$query =3D "select func_a_dummy($arr)= ";
$result =3D pg_query($query);
echo pg_fetch_result($result, 0, 0);=


but the syntax is wrong. Any idea what I should do to make it w= ork
Thank you

--0-2016155230-1163016443=:43259--