П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3522 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 6121 раз(а).

Учебник HTML.
Просмотров 3276 раз(а).

Руководство по PHP5.
Просмотров 5497 раз(а).

Хостинг через призму DNS.
Просмотров 4147 раз(а).

Подборка текстов стандартных документов.
Просмотров 55773 раз(а).

Учебник PHP - Самоучитель
Просмотров 3092 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 5737 раз(а).

Внешние атаки...
Просмотров 3841 раз(а).

Учебник PHP.
Просмотров 2825 раз(а).

SSI в примерах.
Просмотров 37463 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

pg_fetch_array

(PHP 3 >= 3.0.1, PHP 4, PHP 5)

pg_fetch_array -- Fetch a row as an array

Описание

array pg_fetch_array ( resource result [, int row [, int result_type]] )

pg_fetch_array() returns an array that corresponds to the fetched row (record).

pg_fetch_array() is an extended version of pg_fetch_row(). In addition to storing the data in the numeric indices (field number) to the result array, it can also store the data using associative indices (field name). It stores both indicies by default.

Замечание: Эта функция устанавливает NULL-поля в значение NULL PHP.

pg_fetch_array() is NOT significantly slower than using pg_fetch_row(), and is significantly easier to use.

Замечание: row became optional in PHP 4.1.0.

Замечание: result_type was added in PHP 4.0.0.

Список параметров

result

PostgreSQL query result resource, returned by pg_query(), pg_query_params() or pg_execute() (among others).

row

Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, next row is fetched.

result_type

An optional parameter that controls how the returned array is indexed. result_type is a constant and can take the following values: PGSQL_ASSOC, PGSQL_NUM and PGSQL_BOTH. Using PGSQL_NUM, pg_fetch_array() will return an array with numerical indices, using PGSQL_ASSOC it will return only associative indices while PGSQL_BOTH, the default, will return both numerical and associative indices.

Возвращаемые значения

An array indexed numerically (beginning with 0) or associatively (indexed by field name), or both. Each value in the array is represented as a string. Database NULL values are returned as NULL.

FALSE is returned if row exceeds the number of rows in the set, there are no more rows, or on any other error.

Примеры

Пример 1. pg_fetch_array() example

<?php

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

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

$arr = pg_fetch_array($result, 0, PGSQL_NUM);
echo
$arr[0] . " <- Row 1 Author\n";
echo
$arr[1] . " <- Row 1 E-mail\n";

// As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead,
// to pass a result_type.  Successive calls to pg_fetch_array will return the
// next row.
$arr = pg_fetch_array($result, NULL, PGSQL_ASSOC);
echo
$arr["author"] . " <- Row 2 Author\n";
echo
$arr["email"] . " <- Row 2 E-mail\n";

$arr = pg_fetch_array($result);
echo
$arr["author"] . " <- Row 3 Author\n";
echo
$arr[1] . " <- Row 3 E-mail\n";

?>



Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru