PHP.mk документација

CollectionFind::bind

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

mysql-xdevapi-collectionfind.bind.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека mysql-xdevapi-collectionfind.bind.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
CollectionFind::bind

Референца за `mysql-xdevapi-collectionfind.bind.php` со подобрена типографија и навигација.

mysql-xdevapi-collectionfind.bind.php

CollectionFind::bind

(Нема достапни информации за верзијата, можеби е само во Git)

CollectionFind::bindBind value to query placeholder

= NULL

public mysql_xdevapi\CollectionFind::bind(array $placeholder_values): mysql_xdevapi\CollectionFind

It allows the user to bind a parameter to the placeholder in the search condition of the find operation. The placeholder has the form of :NAME where ':' is a common prefix that must always exists before any NAME, NAME is the actual name of the placeholder. The bind function accepts a list of placeholders if multiple entities have to be substituted in the search condition.

Параметри

placeholder_values

Values to substitute in the search condition; multiple values are allowed and are passed as an array where "PLACEHOLDER_NAME => PLACEHOLDER_VALUE".

Вратени вредности

A CollectionFind object, or chain with execute() to return a Result object.

Примери

Пример #1 mysql_xdevapi\CollectionFind::bind() example

<?php
$session
= mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();

$schema = $session->getSchema("addressbook");
$create = $schema->createCollection("people");
$result = $create
->add('{"name": "Alfred", "age": 18, "job": "Butler"}')
->
execute();

// ...

$collection = $schema->getCollection("people");

$result = $collection
->find('job like :job and age > :age')
->
bind(['job' => 'Butler', 'age' => 16])
->
execute();

var_dump($result->fetchAll());
?>

Горниот пример ќе прикаже нешто слично на:

array(1) {
  [0]=>
  array(4) {
    ["_id"]=>
    string(28) "00005b6b536100000000000000cf"
    ["age"]=>
    int(18)
    ["job"]=>
    string(6) "Butler"
    ["name"]=>
    string(6) "Alfred"
  }
}

Белешки од корисници

Нема белешки од корисници за оваа страница.
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.