ID:               44639
 Updated by:       sjo...@php.net
 Reported By:      jgauld at blueyonder dot co dot uk
 Status:           Open
 Bug Type:         PDO related
 Operating System: WinXP
 PHP Version:      5.2.10
 New Comment:

The third parameter to bindValue defaults to PDO::PARAM_STR. This is
different than the original bug reporter said, so it must be changed in
the meantime. Because the datatype is PDO::PARAM_STR, the int is cast to
a string and quoted.

It would make sense to use the PHP type to determine the most logical
PDO::PARAM_* type. See also bug #44597, which is essentially the same
problem but with booleans and execute() instead of bindValue().


Previous Comments:
------------------------------------------------------------------------

[2009-08-17 17:38:15] j...@php.net

But you didn't bother updating the version field. Done now..

------------------------------------------------------------------------

[2009-07-21 00:30:49] whistl0r+php at googlemail dot com

Hi,

this bug is still present in the current PHP version.
Tested with PHP 5.2.10 stable and snapshot on Windows.

MySQL client api: 5.1.35

------------------------------------------------------------------------

[2008-10-21 11:59:03] jgauld at blueyonder dot co dot uk

Tried windows snapshot as suggested (5.2.7RC2-dev), but no joy. Result
is same, ie:

select * from my_table where id>'13'

If it helps, phpinfo() reports:

PDO Driver for MySQL, client library version    5.0.51a

------------------------------------------------------------------------

[2008-07-03 15:17:35] u...@php.net

This is not a driver issue. Its the PDO SQL driver messing up SQL
statements.

------------------------------------------------------------------------

[2008-06-12 13:42:35] dobamail at gmail dot com

Hi.
PDO::MySQL
The code:
            $stmt   = $db->prepare('
                SELECT  id, hu_name, ord
                FROM    products
                ORDER BY ord DESC, hu_name
                LIMIT   :offset, :limit
            ');
            $stmt->bindValue(':offset', ($offset*$limit));
            $stmt->bindValue(':limit',  $limit);
            $stmt->execute();
It is work on:
- PHP Version 5.2.0-8+etch11;
- PDO Driver for MySQL, client library version 5.0.32
- MySQL version: 5.0.32-Debian_7etch5-log
Not work on:
- PHP Version 5.2.3-1ubuntu6.3
- PDO Driver for MySQL, client library version 5.0.45
- 5.0.45-Debian_1ubuntu3.3

I hope this help you.
Best regards.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/44639

-- 
Edit this bug report at http://bugs.php.net/?id=44639&edit=1

Reply via email to