php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #37401 PDO statement preparing - missing example
Submitted: 2006-05-10 18:42 UTC Modified: 2007-01-22 01:12 UTC
From: stochnagara at hotmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2006-05-10 18:42 UTC] stochnagara at hotmail dot com
Description:
------------
The example 1 on page
http://www.php.net/manual/en/function.pdo-prepare.php
shows how we can prepare an SQL statement with named parameters.
The example shows that parameters are passed in this way:
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
I think there should be one more example that shows using parameters without ':' in front of each parameter, e.g.

$sth->execute(array('calories' => 150, 'colour' => 'red'));

This would be a valuable example because most of the people do not know this convinient way of passing parameters without the need to foreach an array and add ':' in front of every key.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-22 01:12 UTC] didou@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.


 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of didou
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=bee17b4802b72a0eb9c6fc5168c0370071433a0c
Log: Fix #37401: Show that we can also lose the : before the parameter name
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 16:01:35 2025 UTC