Re: Looking for some assistance / guidance --
Jeff Silberberg <[email protected]> Mon, 28 Jul 2014 21:26:28 -0400
| Newsgroups | gmane.comp.db.postgresql.php |
|---|---|
| Message-ID | <CALWasQ=1E0R3DD=dawXsoWn5V=Fn+Q6JUvU9ygwA74vH_QP-bQ@mail.gmail.com> |
--089e0102ee04c9882504ff4aed33
Content-Type: text/plain; charset=UTF-8
Nope ---
http://php.net/manual/en/function.pg-prepare.
If any parameters are used, they are referred to in the query as $1,
$2, etc.
On Mon, Jul 28, 2014 at 9:03 PM, Matthias Ritzkowski <[email protected]>
wrote:
> Is the array maybe zero-based?
>
> Did you try 'select web.sendKeys$0, $1, $2, $3' ....
>
> Regards
> Matthias
>
>
> On 7/28/14, 8:45 PM, Jeff Silberberg wrote:
>
> Good evening --
>
> I have a Wordpress / HTML form that includes <select size="5" multiple
> name=Keys[]"....>
>
> The form calls a PHP CGI program and if I set it to phpinfo() I see that
> the array Keys is in the post data. An I can do a $selectedKeys =
> $_POST('Keys') and walk through and echo out the array elements without a
> problem.
>
> My issues start when I attempt to pass the array of Keys to my PostgreSql
> function with a parameter list of (web_Keys_ integer[], web_text_ text,
> web_user_ text) ................
>
> in my php I do a pg_connect, and then prepare a number of statements all
> of which work but the last one.
>
> it is $return_cde = pg_prepare($conn, "SendKeys", 'select
> web.sendKeys$1, $2, $3)');.
>
> and I try to execute this with
>
> $userKey=$_POST['Keys'];
> $userText=$_POST['msgText'] . " / " . $current_user->display_name;
>
> $return = pg_execute($conn, "SendKeys", array($userKey, $userText,
> $current_user->display_name));
>
> Which returns and error --
> function.pg-execute
> <http://dispatch.dapage.net/cgi-bin/function.pg-execute>]: Query failed:
> ERROR: array value must start with "{" or dimension information in
> */home/xxxxxxx/public_html/enterkey/cgi-bin/xxxxxxcgi.php* on line *90*
>
> echo "User Keys " . gettype($userKey)."<br>\n"; confirms this is a
> Array .. An I have tried casting $1::int[] in the prepare with no
> luck..
>
> I find a lot of hits on Google searches but no solutions..
>
> Hoping someone here can assist me with this issue..
>
> =============
>
>
>
>
--089e0102ee04c9882504ff4aed33
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Nope ---<br><br>=C2=A0=C2=A0=C2=A0 <a href=3D"http://php.n=
et/manual/en/function.pg-prepare">http://php.net/manual/en/function.pg-prep=
are</a>.<br><br>=C2=A0=C2=A0=C2=A0 If any parameters=20
are used, they are referred to in the <code class=3D"">query</code> as =
$1, $2, etc.<br><br><br><br><div class=3D"gmail_extra"><div class=3D"gmail_=
quote">On Mon, Jul 28, 2014 at 9:03 PM, Matthias Ritzkowski <span dir=3D"lt=
r"><<a href=3D"mailto:[email protected]" target=3D"_blank">matthiar@gma=
il.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=20
=20
=20
<div text=3D"#000000" bgcolor=3D"#FFFFFF">
Is the array maybe zero-based?<br>
<br>
Did you try 'select web.sendKeys$0, $1, $2, $3' ....<br>
<br>
Regards<span class=3D"HOEnZb"><font color=3D"#888888"><br>
Matthias</font></span><div><div class=3D"h5"><br>
<br>
<div>On 7/28/14, 8:45 PM, Jeff Silberberg
wrote:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>
<div>
<div>
<div>
<div>
<div>Good evening -- <br>
</div>
<div><br>
</div>
I have a Wordpress / HTML form that includes
<select size=3D"5" multiple name=3DKeys[]&qu=
ot;....><br>
<br>
</div>
The form calls a PHP CGI program and if I set it to
phpinfo()=C2=A0 I see that the array Keys is in the post
data.=C2=A0 An I can do a $selectedKeys =3D $_POST('Key=
s')=C2=A0 and
walk through and echo out the array elements without a
problem.=C2=A0 <br>
<br>
</div>
My issues start when I attempt to pass the array of Keys
to my PostgreSql function with a parameter list of
(web_Keys_ integer[], web_text_ text, web_user_ text)
................<br>
<br>
</div>
in my php I do a pg_connect, and then prepare a number of
statements all of which work but the last one.=C2=A0 <br>
<br>
</div>
=C2=A0=C2=A0=C2=A0 it is $return_cde =3D pg_prepare($conn, "=
SendKeys", 'select
web.sendKeys$1, $2, $3)');.=C2=A0 <br>
<br>
</div>
=C2=A0=C2=A0 and I try to execute this with <br>
<br>
=C2=A0=C2=A0 =C2=A0=C2=A0 $userKey=3D$_POST['Keys'];<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $userText=3D$_POST['msgText'=
] . " / " .
$current_user->display_name;<br>
<br>
=C2=A0=C2=A0 =C2=A0=C2=A0 $return =3D pg_execute($conn, "SendK=
eys", array($userKey,
$userText, $current_user->display_name));<br clear=3D"all">
<div>
<div>
<div>
<div><br>
</div>
<div>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Which returns and error -=
- <br>
<h2 style=3D"margin-left:40px">
<font><span style=3D"font-family:courier new,monospace"><=
a href=3D"http://dispatch.dapage.net/cgi-bin/function.pg-execute" target=3D=
"_blank">function.pg-execute</a>]:
Query failed: ERROR: array value must start with
"{" or dimension information in <b>/home/xx=
xxxxx/public_html/enterkey/cgi-bin/xxxxxxcgi.php</b>
on line <b>90</b></span></font></h2>
</div>
<div><br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 echo "User Keys " =
.
gettype($userKey)."<br>\n";=C2=A0=C2=A0 con=
firms this is a
Array ..=C2=A0=C2=A0=C2=A0 An I have tried casting=C2=A0 $1=
::int[]=C2=A0 in the
prepare with no luck.. <br>
<br>
</div>
<div>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 I find a lot of hits on G=
oogle searches but no
solutions.. <br>
<br>
</div>
<div>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Hoping someone here can a=
ssist me with this
issue.. <br>
<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br>
</div>
<div><br>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br><br clear=3D"all"><br>
</div></div>
--089e0102ee04c9882504ff4aed33--