Документация PHP


maxdb_num_fields

maxdb_options

MaxDB PHP Функции

PHP Manual


maxdb_num_rows

(PECL maxdb:1.0-7.6.00.38)

maxdb_num_rows — Gets the number of rows in a result

Описание

Procedural style:

int maxdb_num_rows ( resource $result )

Object oriented style (property):

maxdb

int$num_rows;

Returns the number of rows in the result set.

The use of maxdb_num_rows() depends on whether you use buffered or unbuffered result sets. In case you use unbuffered resultsets maxdb_num_rows() will not correct the correct number of rows until all the rows in the result have been retrieved.

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

Returns number of rows in the result set.

Замечание: If the number of rows is greater than maximal int value, the number will be returned as a string.

Примеры

Пример #1 Object oriented style

<?php
$maxdb 
= new maxdb("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

if (
$result $maxdb->query("SELECT cno, name FROM hotel.customer ORDER BY name")) {

   
/* determine number of rows result set */
   
$row_cnt $result->num_rows;

   
printf("Result set has %d rows.\n"$row_cnt);

   
/* close result set */
   
$result->close();
}

/* close connection */
$maxdb->close();
?>

Пример #2 Procedural style

<?php
$link 
maxdb_connect("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

if (
$result maxdb_query($link"SELECT cno, name FROM hotel.customer ORDER BY name")) {

   
/* determine number of rows result set */
   
$row_cnt maxdb_num_rows($result);

   
printf("Result set has %d rows.\n"$row_cnt);

   
/* close result set */
   
maxdb_free_result($result);
}

/* close connection */
maxdb_close($link);
?>

The above examples would produce the following output:

Result set has 15 rows.

Смотрите также


maxdb_num_fields

maxdb_options

MaxDB PHP Функции

PHP Manual

SAPE все усложнил?

MainLink - простая и прибыльная продажа ссылок!

Последние поступления:

Размещена 10 августа 2020 года

Я по ТВ видел, что через 10 лет мы будем жить лучше, чем в Германии...
Я не понял, что это они с Германией сделать хотят?!

читать далее…

ТехЗадание на Землю

Размещена 14 марта 2018 года

Пpоект Genesis (из коpпоpативной пеpеписки)

читать далее…

Шпаргалка по работе с Vim

Размещена 05 декабря 2017 года

Vim довольно мощный редактор, но работа с ним не всегда наглядна.
Например если нужно отредактировать какой-то файл например при помощи crontab, без знания специфики работы с viv никак.

читать далее…

Ошибка: Error: Cannot find a valid baseurl for repo

Размещена 13 сентабря 2017 года

Если возникает ошибка на centos 5 вида
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/

читать далее…

Linux Optimization

Размещена 30 июля 2012 года

Prelink

читать далее…