« mysql_xdevapi\TableSelect
TableSelect::__construct »

TableSelect::bind

(No version information available, might only be in Git)

TableSelect::bind — select のクエリパラメータをバインドする

説明

public function mysql_xdevapi\TableSelect::bind(array $placeholder_values): mysql_xdevapi\TableSelect

特定のプレースホルダーの値をバインドします。

パラメータ

placeholder_values

プレースホルダーの名前、およびバインドする値

戻り値

TableSelect オブジェクトを返します。

例

例1 mysql_xdevapi\TableSelect::bind() の例

<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$schema = $session->getSchema("addressbook");
$table  = $schema->getTable("names");

$result = $table->select('name','age')
  ->where('name like :name and age > :age')
  ->bind(['name' => 'John', 'age' => 42])
  ->execute();

$row = $result->fetchAll();
print_r($row);
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [0] => Array
        (
            [name] => John
            [age] => 42
        )
)
関連キーワード:
TableSelect   mysql   xdevapi   バインド   bind   クエリ   placeholder   values   プレースホルダー   session   schema   table   John   construct   information   available   特定   getSession   mysqlx   user   password   localhost   getSchema   addressbook   getTable
関連する関数・ページ:
mysql-xdevapi-tableselect.construct   mysql-xdevapi-tableselect.execute   mysql-xdevapi-tableselect.where   mysql-xdevapi-tableselect.limit   mysql-xdevapi-tableselect.lockshared   mysql-xdevapi-tableselect.lockexclusive