Re: [PHP-DB] use php variable within postgresql query

[email protected] (Aziz Saleh) Fri, 9 Jun 2023 11:19:39 -0400
Newsgroups php.db
Message-ID <CAPJtNhUzcFn5p3ofcgs=JqEwjEDV7Fzcv18MP0tCEPnMgpnOfw@mail.gmail.com>
--00000000000000206b05fdb3e844
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

That was a bad copy/paste on his part. Syntax errors will not allow PHP to
even run the code.

On Fri, Jun 9, 2023 at 11:14=E2=80=AFAM G. Franklin <[email protected]> wr=
ote:

> My friends,
>
> Would not the syntax of "$query=3D$_GET['databasecolumn'[;" be part of th=
e
> 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
> the
> > query to fail also.
> >
> > On Fri, Jun 9, 2023 at 5:06=E2=80=AFAM e-letter <[email protected]> wrot=
e:
> >
> > > 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
> exist
> > >
> > > Any advice please?
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>

--00000000000000206b05fdb3e844--