use php variable within postgresql query
| From: | e-letter | 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 php-db+get-49209@lists.php.net 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?