PHP 8.3.4 Released!

mysqli_result::__construct

(PHP 5, PHP 7, PHP 8)

mysqli_result::__constructConstructs a mysqli_result object

Açıklama

public mysqli_result::__construct(mysqli $mysql, int $result_mode = MYSQLI_STORE_RESULT)

This method constructs a new mysqli_result object.

It can be used to create the mysqli_result object after calling the mysqli_real_query() or mysqli_multi_query() function. Constructing the object manually is equivalent to calling the mysqli_store_result() or mysqli_use_result() function.

Bağımsız Değişkenler

bağlantı

Sadece yordamsal tarz: mysqli_connect() veya mysqli_init() işlevinden dönen bir mysqli nesnesi.

result_mode

The result mode can be one of 2 constants indicating how the result will be returned from the MySQL server.

MYSQLI_STORE_RESULT (default) - creates a mysqli_result object with buffered result set.

MYSQLI_USE_RESULT - creates a mysqli_result object with unbuffered result set. As long as there are pending records waiting to be fetched, the connection line will be busy and all subsequent calls will return error Commands out of sync. To avoid the error all records must be fetched from the server or the result set must be discarded by calling mysqli_free_result(). The connection must remain open for the rows to be fetched.

Hatalar/İstisnalar

Eğer mysqli hata bildirimi etkinse (MYSQLI_REPORT_ERROR) ve istenen işlem başarısız olursa bir uyarı üretilir. Ek olarak, kip MYSQLI_REPORT_STRICT ise bunun yerine mysqli_sql_exception istisnası oluşur.

Örnekler

Örnek 1 Creation of a mysqli_result object

<?php

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

/* Select queries return a result set */
$mysqli->real_query("SELECT Name FROM City LIMIT 10");

$result = new mysqli_result($mysqli);
printf("Select returned %d rows.\n", $result->num_rows);

The above examples will output something similar to:

Select returned 10 rows.

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top