php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #37290 Doesn't say how indexes of input array are interpreted
Submitted: 2006-05-03 12:06 UTC Modified: 2006-05-03 15:23 UTC
From: spam01 at pornel dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spam01 at pornel dot net
New email:
PHP Version: OS:

 

 [2006-05-03 12:06 UTC] spam01 at pornel dot net
Description:
------------
http://php.net/manual/en/function.pdostatement-execute.php

PDOStatement::execute() may accept input array with parameters, but docs doen't specify how this array is used.

This is important, because bindParam oddly expects indexes starting from 1 and it looks that execute() expects different indexing, starting from 0.

Also invalid indexes seem to be ignored. Is this intended behavior?



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-03 15:05 UTC] dbs@php.net
"Example 2. Execute a prepared statement with an array of insert values" demonstrates how to pass an input array. 

Writing about how bindParam takes 1-based indexes for arguments, while the input array to PDOStatement::execute() takes a 0-based index, is just going to confuse users. Less is more, and examples rule.
 [2006-05-03 15:11 UTC] spam01 at pornel dot net
Example 2 contains only associative array vs named parameters, so it doesn't show how indexes of '?' are handled.

The only example that uses '?' placeholders is #3, which uses bindParam starting from 1.

I find these examples irrelevant to the case, if not confusing.
 [2006-05-03 15:23 UTC] dbs@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Example 2 is now "Example 2. Execute a prepared statement with an array of insert values (named parameters)".

To address your concern, I added another example: "Example 3. Execute a prepared statement with an array of insert values (placeholders)".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 02 19:00:02 2025 UTC