From: lvm99 at mail dot ru
Operating system: Windows
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: bindParam on UPDATE error
Description:
------------
ODBC connection to MSSQL
$sql = "UPDATE sources_test SET title=:title, name=:name WHERE id=:id";
$sth = $db->prepare($sql);
$params = array(':title'=>'updated with params',
':name'=>'new name', ':id'=>'9586850')
$isOk = $sth->execute($params);
all param's fields (title, name) filling with ':id' value i.e. '9586850'
If I bind just 'id' as param UPDATE works right
or
If I bind 'title' and 'name' but not id UPDATE works right
or
If I connect throut MSSQL interface everything is OK
Reproduce code:
---------------
//MSSQL Server 2000
$dsn ='server';
$database = 'testbase';
$login ='us';
$password = 'us';
//...
$db = new PDO("odbc:Driver={SQL Server}; Server=".$dsn.";
Database=".$database, $login, $password, array(PDO::ERRMODE_EXCEPTION =>
true));
//...
$sql = "UPDATE sources_test SET title=:title, name=:name WHERE id=:id";
$sth = $db->prepare($sql);
$params = array(':title'=>'updated with params',
':name'=>'new name', ':id'=>'9586850')
$isOk = $sth->execute($params);
Expected result:
----------------
Fields have to be set to
name = 'new name'
title='updated with params'
Actual result:
--------------
name = '9586850'
title= '9586850'
--
Edit bug report at http://bugs.php.net/?id=36143&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36143&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36143&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36143&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36143&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36143&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36143&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36143&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36143&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36143&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36143&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36143&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36143&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36143&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36143&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36143&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36143&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36143&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36143&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36143&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36143&r=mysqlcfg