Re: use php variable within postgresql query

"G. Franklin" <[email protected]> Fri, 9 Jun 2023 11:14:02 -0400
Newsgroups gmane.comp.php.database
Message-ID <CAEFeCekkZ=_HrLGDRGQFF4FCwzmiRrDYmhWng5hPEJ4A4MtHEA@mail.gmail.com>
--000000000000dac73c05fdb3d334
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

My friends,

Would not the syntax of "$query=3D$_GET['databasecolumn'[;" be part of the
issue?

I believe the brackets should be closed like this, no?
"$query=3D$_GET['databasecolumn'];"

~G.



On Fri, 9 Jun 2023 at 10:53, Aziz Saleh <[email protected]> wrote:

> Read and understand these, should help you:
>
> https://www.php.net/manual/en/language.types.array.php
>
> Basically its databasecolumnname get param is not defined (set) causing t=
he
> query to fail also.
>
> On Fri, Jun 9, 2023 at 5:06=E2=80=AFAM e-letter <[email protected]> wrote:
>
> > Readers,
> >
> > Suppose:
> >
> > $query=3D$_GET['databasecolumn'[;
> >
> > $anotherquery=3Dpg_query($databaseconnection, 'SELECT * FROM
> > databasename WHERE databasecolumnname=3D"'.$query.';"');
> >
> > Two errors are reported:
> >
> > PHP Notice:  Undefined index: databasecolumnname
> >
> > PHP Warning:  pg_query(): Query failed: ERROR:  column ";" does not exi=
st
> >
> > Any advice please?
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

--000000000000dac73c05fdb3d334--