Re: use php variable within postgresql query

From: Date: Fri, 09 Jun 2023 14:53:13 +0000
Subject: Re: use php variable within postgresql query
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-49210@lists.php.net to get a copy of this message
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 AM e-letter <inpost@gmail.com> wrote:

> Readers,
>
> Suppose:
>
> $query=$_GET['databasecolumn'[;
>
> $anotherquery=pg_query($databaseconnection, 'SELECT * FROM
> databasename WHERE databasecolumnname="'.$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
>
>


Thread (9 messages)

« previous php.db (#49210) next »