« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 13 for colour (0.003 sec.)
PDOStatement::execute — プリペアドステートメントを実行する | PHP 8.3 12000
PDOStatement::execute (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDOStatement::execute — プリペアドステートメントを実行する 説明 public function PDOStatement::execute ( ? array $params = null ): bool プリペアドステートメント を実行し ... ドを伴うプリペアドステートメントの実行 <?php /* 変数や値のバインドを伴うプリペアドステートメントの実行 */ $calories = 150 ; $colour = 'gre' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour LIKE :c ... , $calories , PDO :: PARAM_INT ); /* 名前の前にも、コロン ":" を付けることができます(オプション) */ $sth -> bindValue ( ':colour' , "% $colour %" ); $sth -> execute (); ?> 例2 名前付きの値を伴うプリペアドステートメントの実行 <?php /* 入力値の配列を伴う ... プリペアドステートメントの実行 */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colo ...
https://man.mtool.work/php/8.3/pdostatement.execute.html
PDOStatement::debugDumpParams — SQL プリペアドコマンドを出力する | PHP 8.3 11701
PDOStatement::debugDumpParams (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.9.0) PDOStatement::debugDumpParams — SQL プリペアドコマンドを出力する 説明 public function PDOStatement::debugDumpParams (): ? bool プリペアドステートメントに含まれる ... ment::debugDumpParams() の例 <?php /* プリペアドステートメントを、PHP の変数をバインドして実行します */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colo ... ur' ); $sth -> bindParam ( ':calories' , $calories , PDO :: PARAM_INT ); $sth -> bindValue ( ':colour' , $colour , PDO :: PARAM_STR , 12 ); $sth -> execute (); $sth -> debugDumpParams (); ?> 上の例の出力は以下となります。 SQ ... L: [96] SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour Params: 2 Key: Name: [9] :calories paramno=-1 name=[9 ...
https://man.mtool.work/php/8.3/pdostatement.debugdumpparams.html
PDOStatement::bindParam — 指定された変数名にパラメータをバインドする | PHP 8.3 10522
PDOStatement::bindParam (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDOStatement::bindParam — 指定された変数名にパラメータをバインドする 説明 public function PDOStatement::bindParam ( string | int $param , mixed &$var , int $type = PD ... ドステートメントを実行する <?php /* バインドされた PHP 変数によってプリペアドステートメントを実行する */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colo ... , $calories , PDO :: PARAM_INT ); /* 名前の前にも、コロン ":" を付けることができます(オプション) */ $sth -> bindParam ( ':colour' , $colour , PDO :: PARAM_STR ); $sth -> execute (); ?> 例2 疑問符プレースホルダを用いてプリペアドステートメントを実行する ... <?php /* バインドされた PHP 変数によってプリペアドステートメントを実行する */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?' ); $sth -> ...
https://man.mtool.work/php/8.3/pdostatement.bindparam.html
PDOStatement::bindValue — 値をパラメータにバインドする | PHP 8.3 10064
PDOStatement::bindValue (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 1.0.0) PDOStatement::bindValue — 値をパラメータにバインドする 説明 public function PDOStatement::bindValue ( string | int $param , mixed $value , int $type = PDO::PARAM_STR ... ドステートメントを実行する <?php /* バインドされた PHP 変数によってプリペアドステートメントを実行する */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colo ... , $calories , PDO :: PARAM_INT ); /* 名前の前にも、コロン ":" を付けることができます(オプション) */ $sth -> bindValue ( ':colour' , $colour , PDO :: PARAM_STR ); $sth -> execute (); ?> 例2 疑問符プレースホルダを用いてプリペアドステートメントを実行する ... <?php /* バインドされた PHP 変数によってプリペアドステートメントを実行する */ $calories = 150 ; $colour = 'red' ; $sth = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?' ); $sth -> ...
https://man.mtool.work/php/8.3/pdostatement.bindvalue.html
PDOStatement::fetchAll — 結果セットから、残っている行を取得する | PHP 8.3 10011
PDOStatement::fetchAll (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDOStatement::fetchAll — 結果セットから、残っている行を取得する 説明 public function PDOStatement::fetchAll ( int $mode = PDO::FETCH_DEFAULT ): array public function P ... を返す可能性がありました。 例 例1 結果セットに残っている全ての行をフェッチする <?php $sth = $dbh -> prepare ( "SELECT name, colour FROM fruit" ); $sth -> execute (); /* 結果セットに残っている全ての行をフェッチする */ print "Fetch all of the remaining ro ... 下のようになります。 Fetch all of the remaining rows in the result set: Array ( [0] => Array ( [name] => apple [0] => apple [colour] => red [1] => red ) [1] => Array ( [name] => pear [0] => pear [colour] => green [1] => green ) [2] => Array ( [name] => w ... atermelon [0] => watermelon [colour] => pink [1] => pink ) ) 例2 結果セットから単一カラムの全ての値を取得する 以下の例は、 SQL ステートメント自身が行毎に複数の ...
https://man.mtool.work/php/8.3/pdostatement.fetchall.html
PDOStatement::fetch — 結果セットから次の行を取得する | PHP 8.3 8199
PDOStatement::fetch (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDOStatement::fetch — 結果セットから次の行を取得する 説明 public function PDOStatement::fetch ( int $mode = PDO::FETCH_DEFAULT , int $cursorOrientation = PDO::FETCH_ORI_N ... なる取得方法で行を取得する <?php $db = new PDO ( 'sqlite::memory:' ); $db -> exec ( "CREATE TABLE fruit (name VARCHAR(100), colour VARCHAR(100))" ); $db -> exec ( "INSERT INTO fruit (name, colour) VALUES ('apple', 'red'), ('banana', 'yellow'), ('orange' ... , 'orange'), ('kiwi', 'green')" ); $sth = $db -> prepare ( "SELECT name, colour FROM fruit" ); $sth -> execute (); /* Exercise PDOStatement::fetch styles */ echo "PDO::FETCH_ASSOC: " ; echo "Return next ... となります。 PDO::FETCH_ASSOC: Return next row as an array indexed by column name array(2) { ["name"]=> string(5) "apple" ["colour"]=> string(3) "red" } PDO::FETCH_BOTH: Return next row as an array indexed by both column name and number array(4) { ["nam ...
https://man.mtool.work/php/8.3/pdostatement.fetch.html
PDO::prepare — 文を実行する準備を行い、文オブジェクトを返す | PHP 8.3 8129
PDO::prepare (PHP 5 >= 5.1.0, PHP 7, PHP 8, PHP 8,PECL pdo >= 0.1.0) PDO::prepare — 文を実行する準備を行い、文オブジェクトを返す 説明 public function PDO::prepare ( string $query , array $options = [] ): PDOStatement | false PDOStatement::e ... ステートメントのテンプレートを準備する <?php /* 値の配列を渡してプリペアドステートメントを実行する */ $sql = 'SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour' ; $sth = $dbh -> prepare ( $sql , [ PDO :: ATTR_CURS ... OR => PDO :: CURSOR_FWDONLY ]); $sth -> execute ([ 'calories' => 150 , 'colour' => 'red' ]); $red = $sth -> fetchAll (); /* 配列のキーの前にも、コロン ":" を付けることができます(オプション) */ $sth -> ... execute ([ ':calories' => 175 , ':colour' => 'yellow' ]); $yellow = $sth -> fetchAll (); ?> 例2 疑問符パラメータを用いて SQL ステートメントのテンプレートを準備する ...
https://man.mtool.work/php/8.3/pdo.prepare.html
PDOStatement::fetchColumn — 結果セットの次行から単一カラムを返す | PHP 8.3 7759
PDOStatement::fetchColumn (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.9.0) PDOStatement::fetchColumn — 結果セットの次行から単一カラムを返す 説明 public function PDOStatement::fetchColumn ( int $column = 0 ): mixed 結果セットの次行から単一カ ... れていた場合、 PDOException がスローされます。 例 例1 次行の最初のカラムを返す <?php $sth = $dbh -> prepare ( "SELECT name, colour FROM fruit" ); $sth -> execute (); print "Fetch the first column from the first row in the result set:\n" ; $result = $sth ... " ; print "Fetch the second column from the second row in the result set:\n" ; $result = $sth -> fetchColumn ( 1 ); print "colour = $result \n" ; ?> 上の例の出力は以下となります。 Fetch the first column from the first row in the result set: name = lemo ... n Fetch the second column from the second row in the result set: colour = red 参考 PDO::query() - プレースホルダを指定せずに、SQL ステートメントを準備して実行する PDOStatement::fetch() - 結果セッ ...
https://man.mtool.work/php/8.3/pdostatement.fetchcolumn.html
PDOStatement::bindColumn — カラムを PHP 変数にバインドする | PHP 8.3 7583
PDOStatement::bindColumn (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDOStatement::bindColumn — カラムを PHP 変数にバインドする 説明 public function PDOStatement::bindColumn ( string | int $column , mixed &$var , int $type = PDO::PARA ... にかなったデフォルト値を用いて カラムをバインド、取得するかを例示しています。 <?php $stmt = $dbh -> prepare ( 'SELECT name, colour, calories FROM fruit' ); $stmt -> execute (); /* カラム番号によってバインドする */ $stmt -> bindColumn ( 1 , $name ); $stm ... t -> bindColumn ( 2 , $colour ); /* カラム名によってバインドする */ $stmt -> bindColumn ( 'calories' , $cals ); while ( $stmt -> fetch ( PDO :: FETCH_BO ... UND )) { print $name . "\t" . $colour . "\t" . $cals . "\n" ; } ?> 上の例の出力は、 たとえば以下のようになります。 apple red 150 banana yellow 175 kiwi green 75 ...
https://man.mtool.work/php/8.3/pdostatement.bindcolumn.html
PDO::commit — トランザクションをコミットする | PHP 8.3 7425
PDO::commit (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDO::commit — トランザクションをコミットする 説明 public function PDO::commit (): bool トランザクションをコミットし、 次に PDO::beginTransaction() で新たなトランザクションが開始さ ... -> beginTransaction (); /* 複数レコードを追加する。全部成功か全部失敗のどちらかになる */ $sql = 'INSERT INTO fruit (name, colour, calories) VALUES (?, ?, ?)' ; $sth = $dbh -> prepare ( $sql ); foreach ( $fruits as $fruit ) { $sth -> execute (array( $f ... ruit -> name , $fruit -> colour , $fruit -> calories , )); } /* 変更をコミットする */ $dbh -> commit (); /* データベース接続はオートコミットモードに戻る * ...
https://man.mtool.work/php/8.3/pdo.commit.html
PREV 1 2 NEXT