我在使用db2的IBMi上使用PHP。我有一个testProcedure.php代码的存储过程如下:
// Prepare Stored Procedure call //
$proc = 'CALL WLKLIB.DSH3518SQ(?,?,?)';
$stmt = db2_prepare($conn, $proc) or die("db2_prepare failed " . db2_stmt_error(). " and " .db2_stmt_errormsg());
db2_bind_param($stmt, 1, 'inCuCode', DB2_PARAM_IN,DB2_CHAR);
db2_bind_param($stmt, 2, 'inProdCode', DB2_PARAM_IN,DB2_CHAR);
db2_bind_param($stmt, 3, 'inBuyNum', DB2_PARAM_IN,DB2_CHAR);
db2_execute($stmt);
while (db2_fetch_row($stmt)) {
$Fld1 = db2_result($stmt, 0);
$Fld2 = db2_result($stmt, 1);
$Fld3 = db2_result($stmt, 2);
$Fld4 = db2_result($stmt, 3);
$Fld5 = db2_result($stmt, 4);
$Fld6 = db2_result($stmt, 5);
$Fld7 = db2_result($stmt, 6);
$Fld8 = db2_result($stmt, 7);
$Fld9 = db2_result($stmt, 8);
$Fld10 = db2_result($stmt, 9);
$Fld11 = db2_result($stmt, 10);
$Fld12 = db2_result($stmt, 11);
$Fld13 = db2_result($stmt, 12);
?>
<p><?php echo $Fld1;?> </p>
<p><?php echo $Fld2;?> </p>
<p><?php echo $Fld3;?> </p>
<p><?php echo $Fld4;?> </p>
<p><?php echo $Fld5;?> </p>
<p><?php echo $Fld6;?> </p>
<p><?php echo $Fld7;?> </p>
<p><?php echo $Fld8;?> </p>
<p><?php echo $Fld9;?> </p>
<p><?php echo $Fld10;?> </p>
<p><?php echo $Fld11;?> </p>
<p><?php echo $Fld12;?> </p>
<p><?php echo $Fld13;?> </p>
<?php }?>
执行此文件时,它运行正常并显示数据,但当它与我的其他代码合并时会出现错误,说明&#34; db2_prepare失败&#34;和我使用这两个地方相同的代码你能解决这个问题吗。 p.s数据库连接在顶部的引用中。