Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

pg send prepare function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php pg send prepare () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

pg_send_prepare -- Asynchronously prepares a query for future execution

Syntax

resource pg_send_prepare ( string stmtname, string query )

resource pg_send_prepare ( resource connection, string stmtname, string query )

pg_send_prepare() asynchronously prepares a query on the connection. Unlike pg_prepare(), script execution is not blocked while the query is being prepared. It behaves in the same fashion as pg_send_query().

Parameters to pg_prepare() are specified using placeholders in the query. It is not necessary to quote parameters as quoting and escaping is done automatically. Placeholders are indicated in the query by $1, $2, $3 and so on.

Using prepared queries means you can prepare one and then execute many times, with different parameters. PostgreSQL will cache the query plan on the prepare, then re-use it for each execute, resulting in speed improvements. There is no need to use a prepared query if it will only be executed once. In this case, it is simpler to use pg_query_params().

Examples

Example 1. Using pg_send_prepare()

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

  
// Prepare a query for execution
  
if (!pg_connection_busy($dbconn)) {
    
pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
    
$res1 = pg_get_result($dbconn);
  }

  
// Execute the prepared query.  Note that it is not necessary to escape
  // the string "Joe's Widgets" in any way
  
if (!pg_connection_busy($dbconn)) {
    
pg_send_execute($dbconn, "my_query", array("Joe's Widgets"));
    
$res2 = pg_get_result($dbconn);
  }
  
  
// Execute the same prepared query, this time with a different parameter
  
if (!pg_connection_busy($dbconn)) {
    
pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
    
$res3 = pg_get_result($dbconn);
  }
  
?>

Php pg send prepare Function syntax tag

pg send prepare php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php pg send prepare syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online