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

pg send query function syntax tag tutorial 2013 Donate at flattr Flattr this





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

Php pg send query () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 4 >= 4.2.0, PHP 5)

pg_send_query --  Sends asynchronous query

Syntax

bool pg_send_query ( resource connection, string query )

bool pg_send_query ( string query )

pg_send_query() send asynchronous query to the connection. Unlike pg_query(), it can send multiple query to PostgreSQL and get the result one by one using pg_get_result(). Script execution is not blocked while query is executing. Use pg_connection_busy() to check connection is busy (i.e. query is executing). Query may be cancelled by calling pg_cancel_query().

Although user can send multiple query at once, user cannot send multiple query over busy connection. If query is sent while connection is busy, it waits until last query is finished and discards all result.

Examples

Example 1. Asynchronous Queries

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

  if (!
pg_connection_busy($dbconn)) {
      
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
  }
  
  
$res1 = pg_get_result($dbconn);
  echo
"First call to pg_get_result(): $res1\n";
  
$rows1 = pg_num_rows($res1);
  echo
"$res1 has $rows1 records\n\n";
  
  
$res2 = pg_get_result($dbconn);
  echo
"second call to pg_get_result(): $res2\n";
  
$rows2 = pg_num_rows($res2);
  echo
"$res2 has $rows2 records\n";
?>

The above example will output:

first call to pg_get_result(): Resource id #3
Resource id #3 has 3 records

second call to pg_get_result(): Resource id #4
Resource id #4 has 1 records

Php pg send query Function syntax tag

pg send query 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 query 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