use php variable within postgresql query

From: Date: Fri, 09 Jun 2023 09:05:57 +0000
Subject: use php variable within postgresql query
References: 1  Groups: php.db 
Request: Send a blank email to [email protected] to get a copy of this message
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?


Thread (9 messages)

« previous php.db (#49209) next »