The Code
代码
$options = array('autocommit' => DB2_AUTOCOMMIT_OFF);
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL('?','?','?')");
$connection = db2_connect ( AS400_DATABASE, IS_USER_NAME, IS_USER_PASS, $options );
if (! $connection) {
handleError("Unable to connect to the database.", 2);
}
$REF = "1234567891123456789122";
$PSSN = '123456789';
$SSSN = 123456789;
db2_bind_param($stmt, 1, 'REF', DB2_PARAM_INOUT, DB2_CHAR, 22); //ERROR
db2_bind_param($stmt, 2, "PSSN", DB2_PARAM_INOUT, DB2_CHAR, 9); //ERROR
db2_bind_param($stmt, 3, "SSSN", DB2_PARAM_INOUT, DB2_CHAR, 9); //ERROR
db2_execute($stmt);
I see at this link the answer was to fix the PTF versions. However, that is for "complex queries". This is a very simple program call.
我在这个链接上看到的答案是修复PTF版本。但是,这是针对“复杂查询”的。这是一个非常简单的程序调用。
This code works fine in our live iSeries, which is on PHP 5.2.17
这段代码在我们的live iSeries中工作正常,它在PHP 5.2.17上
This code does not work in our development iSeries, which is now on PHP 5.4.0. The db2_bind_param lines all throw the same error message.
此代码在我们的开发iSeries中不起作用,iSeries现在在PHP 5.4.0上。 db2_bind_param行都抛出相同的错误消息。
Was there some major change in 5.2.x to 5.4? Or is this completely unrelated?
5.2.x到5.4有一些重大变化吗?或者这完全不相关?
I've tried various methods of variable declaration: single quotes, double quotes, no quotes... but none of it has made a difference because of PHP's loosely typed syntax.
我已经尝试了各种变量声明方法:单引号,双引号,没有引号......但由于PHP的松散类型语法,它们没有任何区别。
Also tried removing the single quotes around each parameter in the SQL call, which then just generates an error during the prepare.
还尝试删除SQL调用中每个参数周围的单引号,然后在准备期间只生成错误。
2 个解决方案
#1
0
At first, could you change next lines in your code :
首先,您可以更改代码中的下一行:
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL('?','?','?')");
$connection = db2_connect ( AS400_DATABASE, IS_USER_NAME, IS_USER_PASS, $options )
With next:
下一个:
$connection = db2_connect ( AS400_DATABASE, IS_USER_NAME, IS_USER_PASS, $options )
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL('?','?','?')");
This could solve your issue
这可以解决您的问题
#2
0
Remove the single quotes around the bind markers:
删除绑定标记周围的单引号:
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL(?, ?, ?)");
#1
0
At first, could you change next lines in your code :
首先,您可以更改代码中的下一行:
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL('?','?','?')");
$connection = db2_connect ( AS400_DATABASE, IS_USER_NAME, IS_USER_PASS, $options )
With next:
下一个:
$connection = db2_connect ( AS400_DATABASE, IS_USER_NAME, IS_USER_PASS, $options )
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL('?','?','?')");
This could solve your issue
这可以解决您的问题
#2
0
Remove the single quotes around the bind markers:
删除绑定标记周围的单引号:
$stmt = db2_prepare($connection, "CALL LABLIB2.AR0011CL(?, ?, ?)");