#47803 [NEW]: Executing prepared statements is succesfull only for the first two statements

[email protected] ("egil at wp dot pl")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             egil at wp dot pl
Operating system: Windows XP SP 3
PHP version:      5.2.9
PHP Bug Type:     ODBC related
Bug description:  Executing prepared statements is succesfull only for the first two statements

Description:
------------
I do odbc_prepare and then I would like to be able to execute this
statement with different paramas. This is what it is for, right?
Fortunately not after 2 odbc_execute calls third call gives (mssql 2005 as
you may see):
[Microsoft][SQL Native Client]Invalid character value for cast
specification


Reproduce code:
---------------
<?
$sql = "UPDATE category
	SET name = ?
	WHERE cat_id = ?";
$result = $odbc_prepare($link, $sql);
if (!$result)
{
	trigger_error ('[sql] prep: '.$sql, E_USER_ERROR);
}
foreach ($upd_cats as &$k)
{
	if(!odbc_execute($result, array($k['name'], $k['id'])))
	{
		trigger_error ('[sql] exec: '."array({$k['name']}, {$k['id']})",
E_USER_ERROR);
	}
}
?>

Expected result:
----------------
successful execution (note that it works fine if I move prepare to foreach
block)

Actual result:
--------------
After third execution I get an error:
[Microsoft][SQL Native Client]Invalid character value for cast
specification

-- 
Edit bug report at http://bugs.php.net/?id=47803&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47803&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47803&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47803&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47803&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47803&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47803&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47803&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47803&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47803&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47803&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47803&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47803&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47803&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47803&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47803&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47803&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47803&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47803&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47803&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47803&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47803&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.