|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68037 SQLite3Stmt::bindValue() accepts numeric index parameters
Submitted: 2014-09-17 15:17 UTC Modified: 2017-01-28 12:45 UTC
Avg. Score:3.3 ± 1.7
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: benjamin dot morel at gmail dot com Assigned: cmb (profile)
Status: Closed Package: SQLite related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
47 + 5 = ?
Subscribe to this entry?

 [2014-09-17 15:17 UTC] benjamin dot morel at gmail dot com
The doc for PDOStatement::bindValue():

Says that $sql_param can only be a string:

public bool SQLite3Stmt::bindValue ( string $sql_param , mixed $value [, int $type ] )

> sql_param
> An string identifying the statement variable to which the value should be bound.

However, as the commenter said 4 years ago at the bottom of the page, it can also be an integer for "?" placeholders:

> Note that this also works with positional placeholders using the '?' token:


$stmt = $db->prepare('SELECT * FROM mytable WHERE foo = ? AND bar = ?');
$stmt->bindValue(1, 'somestring', SQLITE3_TEXT);
$stmt->bindValue(2, 42, SQLITE3_INTEGER);


> Positional numbering starts at 1.

So basically it accepts both named parameters and numerically indexed parameters, just like PDO. It would be nice to add this fact to the documentation.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-28 12:45 UTC]
-Status: Open +Status: Closed -Package: Documentation problem +Package: SQLite related -Assigned To: +Assigned To: cmb
 [2017-01-28 12:45 UTC]
Note that PDOStatement and SQLite3Stmt are unrelated classes. I
assume that this bug report is about SQLite3Stmt (as PDOStatement
already stated `mixed` then this ticket has been filed), and as
such this issue is resolved with
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 21 23:03:37 2021 UTC