array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'mysqli-stmt.num-rows.php', 1 => 'mysqli_stmt::$num_rows', 2 => 'Returns the number of rows fetched from the server', ), 'up' => array ( 0 => 'class.mysqli-stmt.php', 1 => 'mysqli_stmt', ), 'prev' => array ( 0 => 'mysqli-stmt.next-result.php', 1 => 'mysqli_stmt::next_result', ), 'next' => array ( 0 => 'mysqli-stmt.param-count.php', 1 => 'mysqli_stmt::$param_count', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysqli/mysqli_stmt/num-rows.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

mysqli_stmt::$num_rows

mysqli_stmt::num_rows

mysqli_stmt_num_rows

(PHP 5, PHP 7, PHP 8)

mysqli_stmt::$num_rows -- mysqli_stmt::num_rows -- mysqli_stmt_num_rowsReturns the number of rows fetched from the server

Açıklama

Nesne yönelimli kullanım

public mysqli_stmt::num_rows(): int|string

Yordamsal kullanım

mysqli_stmt_num_rows(mysqli_stmt $statement): int|string

Returns the number of rows buffered in the statement. This function will only work after mysqli_stmt_store_result() is called to buffer the entire result set in the statement handle.

This function returns 0 unless all rows have been fetched from the server.

Bağımsız Değişkenler

deyim

Sadece yordamsal tarz: mysqli_stmt_init() işlevinden dönen bir mysqli_stmt nesnesi.

Dönen Değerler

An int representing the number of buffered rows. Returns 0 in unbuffered mode unless all rows have been fetched from the server.

Bilginize:

Satır sayısı PHP_INT_MAX'tan büyükse, sayı string türünde döndürülür.

Örnekler

Örnek 1 Nesne yönelimli kullanım

<?php

mysqli_report
(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
$stmt = $mysqli->prepare($query);
$stmt->execute();

/* store the result in an internal buffer */
$stmt->store_result();

printf("Number of rows: %d.\n", $stmt->num_rows);

Örnek 2 Yordamsal kullanım

<?php

mysqli_report
(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
$stmt = mysqli_prepare($link, $query);
mysqli_stmt_execute($stmt);

/* store the result in an internal buffer */
mysqli_stmt_store_result($stmt);

printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt));

Yukarıdaki örneklerin çıktısı:

Number of rows: 20.

Ayrıca Bakınız