Re: function with array parameter - Mailing list pgsql-php

From Talha Khan
Subject Re: function with array parameter
Date
Msg-id f80885fc0611081225h3ff97898n2afde937dc4067a3@mail.gmail.com
Whole thread Raw
In response to function with array parameter  (Jean-Christophe Roux <jcxxr@yahoo.com>)
Responses Re: function with array parameter
unsubscribe
List 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@yahoo.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


pgsql-php by date:

Previous
From: Jean-Christophe Roux
Date:
Subject: function with array parameter
Next
From: Alan Hodgson
Date:
Subject: Re: function with array parameter