note 64226 modified in pdostatement.bindparam by danbrown
| From: | danbrown@php.net | Date: | Tue, 17 May 2011 18:11:48 +0000 |
| Subject: | note 64226 modified in pdostatement.bindparam by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179833@lists.php.net to get a copy of this message | ||
Do not try to use the same named parameter twice in a single SQL statement, for example
<?php
$sql = 'SELECT * FROM some_table WHERE some_value > :value OR some_value < :value';
$stmt = $dbh->prepare($sql);
$stmt->execute( array( ':value' => 3 ) );
?>
...this will return no rows and no error -- you must use each parameter once and only once.
Apparently this is expected behavior (according to this bug report: http://bugs.php.net/bug.php?id=33886) because of
portability issues.
--was--
Do not try to use the same named parameter twice in a single SQL statement, for example
$sql = 'SELECT * FROM some_table WHERE some_value > :value OR some_value < :value';
$stmt = $dbh->prepare($sql);
$stmt->execute( array( ':value' => 3 ) );
...this will return no rows and no error -- you must use each parameter once and only once.
Apparently this is expected behavior (according to this bug report: http://bugs.php.net/bug.php?id=33886) because of
portability issues.
http://php.net/manual/en/pdostatement.bindparam.php