pg_query
Function • Return type changed in PHP 8.1
Execute a query.
pg_query Function synopsis
pg_query($connection, string $query = <default>): PgSql\Result|false
Parameters
$connection
$query
OptionalTypestringDefault value
The SQL statement or statements to be executed. When multiple statements are passed to the function, they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands included in the query string. However, using multiple transactions in one function call is not recommended.
Return value
TypePgSql\Result|false
An PgSql\Result instance on success, or false on failure.
Changes to the pg_query Function
PHP 8.1
- Return type added:
PgSql\Result|false
- pg_query($connection, string $query = <default>)
+ pg_query($connection, string $query = <default>): PgSql\Result|false PHP 8.0
- Parameter type added for parameter #2 (
$query):string - Parameter default value added for position #2 (
$query):<default>
- pg_query($connection, $query)
+ pg_query($connection, string $query = <default>) pg_query Function Availability
pg_query Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |