svn: /phpdoc/en/trunk/reference/pdo/pdostatement/ execute.xml

From: Date: Sun, 27 Mar 2016 15:52:45 +0000
Subject: svn: /phpdoc/en/trunk/reference/pdo/pdostatement/ execute.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14081@lists.php.net to get a copy of this message
tpunt Sun, 27 Mar 2016 15:52:45 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=338832 Log: Resolve doc bug #70119 Bug: https://bugs.php.net/70119 (Open) PDOStatement::execute - ignores bindValue() Changed paths: U phpdoc/en/trunk/reference/pdo/pdostatement/execute.xml Modified: phpdoc/en/trunk/reference/pdo/pdostatement/execute.xml =================================================================== --- phpdoc/en/trunk/reference/pdo/pdostatement/execute.xml 2016-03-27 05:35:21 UTC (rev 338831) +++ phpdoc/en/trunk/reference/pdo/pdostatement/execute.xml 2016-03-27 15:52:45 UTC (rev 338832) @@ -14,13 +14,18 @@ <methodparam choice="opt"><type>array</type><parameter>input_parameters</parameter></methodparam> </methodsynopsis> <para> - Execute the prepared statement. If the prepared statement included - parameter markers, you must either: + Execute the <link linkend="pdo.prepared-statements">prepared + statement</link>. If the prepared statement included parameter markers, you + must either: <itemizedlist> - <listitem><para>call <function>PDOStatement::bindParam</function> to bind PHP variables - to the parameter markers: bound variables pass their value as input and receive the - output value, if any, of their associated parameter markers</para></listitem> - <listitem><para>or pass an array of input-only parameter values</para></listitem> + <listitem><para>call <function>PDOStatement::bindParam</function> and/or + <function>PDOStatement::bindValue</function> to bind either variables or + values (respectively) to the parameter markers. Bound variables pass + their value as input and receive the output value, if any, of their + associated parameter markers</para></listitem> + <listitem> + <para>or pass an array of input-only parameter values</para> + </listitem> </itemizedlist> </para> </refsect1> @@ -88,18 +93,18 @@ <refsect1 role="examples"> &reftitle.examples; - <example><title>Execute a prepared statement with bound variables</title> + <example><title>Execute a prepared statement with a bound variable and value</title> <programlisting role="php"> <![CDATA[ <?php -/* Execute a prepared statement by binding PHP variables */ +/* Execute a prepared statement by binding a variable and value */ $calories = 150; -$colour = 'red'; +$colour = 'gre'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit - WHERE calories < :calories AND colour = :colour'); + WHERE calories < :calories AND colour LIKE :colour'); $sth->bindParam(':calories', $calories, PDO::PARAM_INT); -$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12); +$sth->bindValue(':colour', "%{$colour}%"); $sth->execute(); ?> ]]>

« previous php.doc.cvs (#14081) next »