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

О проекте

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

MySQL

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

Хостинг

Другое








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

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

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

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

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

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

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

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

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

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

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

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



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





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

sesam_fetch_row

(PHP 3 CVS only)

sesam_fetch_row -- Fetch one row as an array

Description

array sesam_fetch_row ( string result_id [, int whence [, int offset]] )

Returns an array that corresponds to the fetched row, or FALSE if there are no more rows.

The number of columns in the result set is returned in an associative array element $array["count"]. Because some of the result columns may be empty, the count() function can not be used on the result row returned by sesam_fetch_row().

result_id is a valid result id returned by sesam_query() (select type queries only!).

whence is an optional parameter for a fetch operation on "scrollable" cursors, which can be set to the following predefined constants:

Таблица 1. Valid values for "whence" parameter

ValueConstantMeaning
0SESAM_SEEK_NEXT read sequentially (after fetch, the internal default is set to SESAM_SEEK_NEXT)
1SESAM_SEEK_PRIOR read sequentially backwards (after fetch, the internal default is set to SESAM_SEEK_PRIOR)
2SESAM_SEEK_FIRST rewind to first row (after fetch, the default is set to SESAM_SEEK_NEXT)
3SESAM_SEEK_LAST seek to last row (after fetch, the default is set to SESAM_SEEK_PRIOR)
4SESAM_SEEK_ABSOLUTE seek to absolute row number given as offset (Zero-based. After fetch, the internal default is set to SESAM_SEEK_ABSOLUTE, and the internal offset value is auto-incremented)
5SESAM_SEEK_RELATIVE seek relative to current scroll position, where offset can be a positive or negative offset value.
This parameter is only valid for "scrollable" cursors.

When using "scrollable" cursors, the cursor can be freely positioned on the result set. If the whence parameter is omitted, the global default values for the scrolling type (initialized to: SESAM_SEEK_NEXT, and settable by sesam_seek_row()) are used. If whence is supplied, its value replaces the global default.

offset is an optional parameter which is only evaluated (and required) if whence is either SESAM_SEEK_RELATIVE or SESAM_SEEK_ABSOLUTE. This parameter is only valid for "scrollable" cursors.

sesam_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array (indexed by values between 0 and $array["count"]-1). Fields may be empty, so you must check for the existence of a field by using the isset() function. The type of the returned fields depend on the respective SQL type declared for its column (see SESAM overview for the conversions applied). SESAM "multiple fields" are "inlined" and treated like a sequence of columns.

Subsequent calls to sesam_fetch_row() would return the next (or prior, or n'th next/prior, depending on the scroll attributes) row in the result set, or FALSE if there are no more rows.

Пример 1. SESAM fetch rows

<?php
$result
= sesam_query("SELECT * FROM phone\n" .
                       
"  WHERE LASTNAME='" . strtoupper($name) . "'\n" .
                       
"  ORDER BY FIRSTNAME", 1);
if (!
$result) {
    
/* ... error ... */
}
// print the table in backward order
echo "<table border=\"1\">\n";
$row = sesam_fetch_row($result, SESAM_SEEK_LAST);
while (
is_array($row)) {
    echo
"<tr>\n";
    for (
$col = 0; $col < $row["count"]; ++$col) {
        echo
"<td>" . htmlspecialchars($row[$col]) . "</td>\n";
    }
    echo
"</tr>\n";
    
// use implied SESAM_SEEK_PRIOR
    
$row = sesam_fetch_row($result);
}
echo
"</table>\n";
sesam_free_result($result);
?>

See also: sesam_fetch_array() which returns an associative array, and sesam_fetch_result() which returns many rows per invocation.


Пред. Начало След.
sesam_fetch_result Уровень выше sesam_field_array


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





Copyright © 2005-2016 Project.Net.Ru