please help me

. why I can't use db2_exec? I use db2 ver 9 and php use wampserver, windows xp. then I get message
Warning: db2_exec() [function.db2-exec]: Statement Execute Failed in C:\wamp\www\Yushan\web_application_with_db2\getrep ort.php on line 71
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hasil Laporan</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background-color: #FFF;
font-size: 82%;
color: #000;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
// Prevent SQL Injection
if(get_magic_quotes_gpc()!=1 && is_array($_GET)) foreach($_GET as $k=>$v) if(is_string($v)) $_GET[$k] = addslashes($v);
$r_ID = trim($_GET['txtID']);
$r_Barcode = trim($_GET['txtBarcode']);
$r_Nama = trim($_GET['txtNama']);
$r_Arrival = trim($_GET['txtArrival']);
$r_Confirmation = trim($_GET['txtConfirmation']);
$r_Paper = trim($_GET['txtPaper']);
$r_Serial = trim($_GET['txtSerial']);
$r_Condition = trim($_GET['txtCondition']);
$r_Location = trim($_GET['txtLocation']);
$r_OrderBy = $_GET['ob'];
if($r_Arrival!='') {
$r_oper_arrival = '=';
if($_GET['ao']=='before') $r_oper_arrival = '<=';
if($_GET['ao']=='after') $r_oper_arrival = '>=';
}
if($r_Confirmation!='') {
$r_oper_confirmation = '=';
if($_GET['co']=='before') $r_oper_confirmation = '<=';
if($_GET['co']=='after') $r_oper_confirmation = '>=';
}
if($r_ID!='') $sql_kondisi_temp[] = "id='$r_ID'";
if($r_Barcode!='') $sql_kondisi_temp[] = "Barcode='$r_Barcode'";
if($r_Nama!='') $sql_kondisi_temp[] = "NamaBarang LIKE '%$r_Nama%'";
if($r_Arrival!='') $sql_kondisi_temp[] = "ArrivalDate $r_oper_arrival '$r_Arrival'";
if($r_Confirmation!='') $sql_kondisi_temp[] = "ConfirmationDate $r_oper_confirmation '$r_Confirmation'";
if($r_Paper!='') $sql_kondisi_temp[] = "PaperNumber='$r_Paper'";
if($r_Serial!='') $sql_kondisi_temp[] = "SerialNumber='$r_Serial'";
if($r_Condition!='') $sql_kondisi_temp[] = "Condition LIKE '%$r_Condition%'";
if($r_Location!='') $sql_kondisi_temp[] = "Location LIKE '%$r_Location%'";
if(is_array($sql_kondisi_temp)) $sql_kondisi = implode(' AND ', $sql_kondisi_temp);
if($sql_kondisi!='') $sql_kondisi = " WHERE $sql_kondisi ";
$sql_order_by = " ORDER BY $r_OrderBy ";
$dbuser="Yushan1987";
$dbpassword="dragon";
$dbname="LAB";
$koneksi= db2_pconnect($dbname,$dbuser,$dbpassword) or exit("Koneksi ke DB2 gagal");
$sql = "SELECT * FROM INVENTORY $sql_kondisi $sql_order_by";
$run=db2_prepare($koneksi, $sql);
if(!($hasil=db2_exec($koneksi,$sql))) exit("DB2 Error");
if(db2_num_rows($hasil)==0) exit("Tidak ada data yang memenuhi kriteria.");
for($i=0;$i<db2_num_rows($hasil);$i++) {
$row = db2_fetch_array($hasil);
$row_temp = '';
foreach($row as $k=>$v) $row_temp .= '<td><span style="margin-right: 6px;">' . htmlspecialchars($v) . '</span></td>';
if($prev_bg=='#FCFCFC') $prev_bg='#F0F0F0'; else $prev_bg='#FCFCFC';
$row_temp = "<tr style=\"background-color: $prev_bg;\">$row_temp</tr>";
$table_temp .= $row_temp;
}
$row_temp = '';
foreach($row as $k=>$v) $row_temp .= '<td style="background-color: #F4EBE1;"><b>' . $k . '</b></td>';
$table_temp = '<table cellpadding="5">' . "$row_temp$table_temp</table>";
echo $table_temp;
?>
</body>
</html>