Executing prepared statements is succesfull only for the first two statements
| Bug #47803 | Executing prepared statements is succesfull only for the first two statements | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2009-03-27 09:10 UTC | Modified: | 2014-12-31 02:13 UTC |
|
||||||||||
| From: | egil at wp dot pl | Assigned: | ||||||||||||
| Status: | Closed | Package: | ODBC related | |||||||||||
| PHP Version: | 5.2.9 | OS: | Windows XP SP 3 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2009-03-27 09:10 UTC] egil at wp dot pl
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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-05-29 10:18 UTC] tom dot graham at jadu dot co dot uk
[2014-07-23 11:18 UTC] egil at wp dot pl
[2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
[2014-12-31 00:21 UTC] egil at wp dot pl
[2014-12-31 02:13 UTC] requinix@php.net
[2016-02-24 10:58 UTC] ab@php.net
-Status: Open +Status: Closed