(沒有版本資訊,可能只在 Git 中)
TableSelect::bind — 綁定查詢參數
將值綁定到特定預留位置。
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 ) )