pg_delete
pg_delete
Deletes records
**pg_delete** PgSql\Connection $connection string $table_name array $conditions int $flags
deletes records from a table
specified by the keys and values in .
pg_delete``conditions
If is specified,
is applied to
with the specified flags.
flags``pg_convert``conditions
By default passes raw values.
Values must be escaped or the flag
must be specified in .
quotes and escapes parameters/identifiers.
Therefore, table/column names become case sensitive.
pg_delete``PGSQL_DML_ESCAPE``flags``PGSQL_DML_ESCAPE
Note that neither escape nor prepared query can protect LIKE query, JSON, Array, Regex, etc. These parameters should be handled according to their contexts. i.e. Escape/validate values.
connection``table_nameName of the table from which to delete rows.
conditions
An whose keys are field names in the table ,
and whose values are the values of those fields that are to be deleted.
array``table_name
flags
Any number of ,
,
,
,
or
combined. If is part of the
then query string is returned. When
or is set, it does not call internally.
PGSQL_CONV_FORCE_NULL``PGSQL_DML_NO_CONV``PGSQL_DML_ESCAPE``PGSQL_DML_EXEC``PGSQL_DML_ASYNC``PGSQL_DML_STRING``PGSQL_DML_STRING``flags``PGSQL_DML_NO_CONV``PGSQL_DML_ESCAPE``pg_convert
return.success Returns if is passed
via .
string``PGSQL_DML_STRING``flags
Voorbeeld: example
<?php
$db = pg_connect('dbname=foo');
// This is safe somewhat, since all values are escaped.
// However PostgreSQL supports JSON/Array. These are not
// safe by neither escape nor prepared query.
$res = pg_delete($db, 'post_log', $_POST, PG_DML_ESCAPE);
if ($res) {
echo "POST data is deleted: $res\n";
} else {
echo "User must have sent wrong inputs\n";
}
?>
pg_convert