Doc #70119 [Com]: PDOStatement::execute - ignores bindValue()
| From: | tpunt@php.net | Date: | Sun, 27 Mar 2016 17:25:59 +0000 |
| Subject: | Doc #70119 [Com]: PDOStatement::execute - ignores bindValue() | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13352@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70119&edit=1
ID: 70119
Comment by: tpunt@php.net
Reported by: chealer at gmail dot com
Summary: PDOStatement::execute - ignores bindValue()
Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: tpunt
Block user comment: N
Private report: N
New Comment:
The updated first code example was for didactic reasons. Since we now mention bindValue() on the
page, it would be nice to demonstrate it. Moreover, none of the examples on the bindParam() or
bindValue() pages demonstrate the usage of both methods when preparing a single query. So I updated
the first example to show this, where "gre" could match "grey" or
"green," whilst showing a common scenario of when bindValue is used over bindParam()
(wildcard insertion).
Previous Comments:
------------------------------------------------------------------------
[2016-03-27 16:48:32] chealer at gmail dot com
Thank you. Note that revision 338832 changes
$colour = 'red';
to
$colour = 'gre';
and Example #1 now uses colour LIKE '%gre%' rather than colour = 'red'. It is
fairly clear that "green" would match, but I find the new version somewhat strange. I
recommend to stay simple or to provide a short description of what the example achieves.
------------------------------------------------------------------------
[2016-03-27 15:52:48] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&revision=338832
Log: Resolve doc bug #70119
------------------------------------------------------------------------
[2015-07-23 17:58:23] chealer at gmail dot com
Description:
------------
If the prepared statement included parameter markers, you must either:
call PDOStatement::bindParam() 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
or pass an array of input-only parameter values
---
From manual page: http://www.php.net/pdostatement.execute
---
In fact, as shown in the examples on http://php.net/manual/en/pdostatement.bindvalue.php,
PDOStatement::bindValue() can be used too.
Note that this page should really link to http://php.net/manual/en/pdo.prepared-statements.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70119&edit=1