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

pg fetch assoc function syntax tag tutorial 2013





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

Php pg fetch assoc () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 4 >= 4.3.0, PHP 5)

pg_fetch_assoc -- Fetch a row as an associative array

Syntax

array pg_fetch_assoc ( resource result [, int row] )

pg_fetch_assoc() returns an associative array that corresponds to the fetched row (tuples/records). It returns FALSE, if there are no more rows.

pg_fetch_assoc() is equivalent to calling pg_fetch_array() with PGSQL_ASSOC for the optional third parameter. It only returns an associative array. If you need the numeric indices, use pg_fetch_row().

Note: This function sets NULL fields to PHP NULL value.

row is row (record) number to be retrieved. First row is 0.

pg_fetch_assoc() is NOT significantly slower than using pg_fetch_row(), while it provides a significant ease of use.

Note: From 4.1.0, row became optional. Calling pg_fetch_assoc() will increment the internal row counter by one.

Examples

Example 1. pg_fetch_assoc() example

<?php
$conn
= pg_connect("dbname=publisher");
if (!
$conn) {
  echo
"An error occured.\n";
  exit;
}

$result = pg_query($conn, "SELECT id, author, email FROM authors");
if (!
$result) {
  echo
"An error occured.\n";
  exit;
}

while (
$row = pg_fetch_assoc($result)) {
  echo
$row['id'];
  echo
$row['author'];
  echo
$row['email'];
}
?>

Php pg fetch assoc Function syntax tag

pg fetch assoc 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 fetch assoc 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