Rechercher une fonction PHP

pg_send_query_params

(PHP 5 >= 5.1.0, PHP 7)

pg_send_query_paramsSubmits a command and separate parameters to the server without waiting for the result(s)

Description

pg_send_query_params ( resource $connection , string $query , array $params ) : bool

Submits a command and separate parameters to the server without waiting for the result(s).

This is equivalent to pg_send_query() except that query parameters can be specified separately from the query string. The function's parameters are handled identically to pg_query_params(). Like pg_query_params(), it will not work on pre-7.4 PostgreSQL connections, and it allows only one command in the query string.

PHP: pg_send_query_params - Manual Home of Manuel PHP  Contents Haut

Parameters

connection

PostgreSQL database connection resource.

query

The parameterized SQL statement. Must contain only a single statement. (multiple statements separated by semi-colons are not allowed.) If any parameters are used, they are referred to as $1, $2, etc.

params

An array of parameter values to substitute for the $1, $2, etc. placeholders in the original prepared query string. The number of elements in the array must match the number of placeholders.

PHP: pg_send_query_params - Manual Home of Manuel PHP  Contents Haut

Return Values

Returns TRUE on success or FALSE on failure.

Use pg_get_result() to determine the query result.

PHP: pg_send_query_params - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 Using pg_send_query_params()

<?php
  $dbconn 
pg_connect("dbname=publisher") or die("Could not connect");

  
// Using parameters.  Note that it is not necessary to quote or escape
  // the parameter.
  
pg_send_query_params($dbconn'select count(*) from authors where city = $1', array('Perth'));
  
  
// Compare against basic pg_send_query usage
  
$str pg_escape_string('Perth');
  
pg_send_query($dbconn"select count(*) from authors where city = '${str}'");
?>

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.pg-send-query-params.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut