PHPReport and Stored Procedure

General discussion on PHP
Post Reply
john2770
Posts: 7
Joined: Wed Oct 07, 2015 5:10 pm

PHPReport and Stored Procedure

Post by john2770 » Mon Oct 19, 2015 7:22 pm

I'm trying to run my PHPReport script with my Stored Procedure Results, everything seems okay but i'm getting not results in my view the code is below

Code: Select all

<?php
include '@ConnectDB.php' ;
include './includes/PHPReport.php';

           
            $inCucode   = "GLLL01";               
            $inProdCode =  "71MRT18818W";   
            $inBuyNum    = "NONS01"; 
            	
            // 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)) {
                $Fld2 =  db2_result($stmt, 1);
                $Fld1  = db2_result($stmt, 0);
                $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);
                
                //Create new PHPReport object
                $R=new PHPReport();
                
                $R->load(array(
                    'id'=>'product',
                    'header'=>array(
                        'SKU','Customer Code','Discontinued', 'Available Quantity','Lead Time','Last Order Quanity','Daily Demand','Days on Hand','PO Last Issued Date','PO Quantity','Price','Product Description','Company Code'
                  ),
                    
                   'config'=>array(
                       0=>array('width'=>120,'align'=>'right'),
                       1=>array('width'=>100,'align'=>'left'),
                       2=>array('width'=>120,'align'=>'left'),
                       3=>array('width'=>120,'align'=>'left'),
                       4=>array('width'=>120,'align'=>'left'),
                       5=>array('width'=>120,'align'=>'left'),
                       6=>array('width'=>120,'align'=>'left'),
                       7=>array('width'=>120,'align'=>'left'),
                       8=>array('width'=>120,'align'=>'left'),
                       9=>array('width'=>120,'align'=>'left'),
                       10=>array('width'=>120,'align'=>'left'),
                       11=>array('width'=>200,'align'=>'left'),
                       12=>array('width'=>120,'align'=>'left'),
                       ),
                    'data'=>array(
                        array($Fld2),
                        array($Fld1),
                        array($Fld3),
                        array($Fld4),
                        array($Fld5),
                        array($Fld6),
                        array($Fld7),
                        array($Fld8),
                        array($Fld9),
                        array($Fld10),
                        array($Fld11),
                        array($Fld12),
                        array($Fld13)
                    ),
                )
                    
              );
                echo $R->render();
                exit();
            }
  ?>
I'm i missing anything, why i'm i not getting any results in my view the page is just blank no errors nothing.

john2770
Posts: 7
Joined: Wed Oct 07, 2015 5:10 pm

Re: PHPReport and Stored Procedure

Post by john2770 » Mon Oct 19, 2015 8:29 pm

I troubleshooted and it came down to the 'db2_execute($stmt);' doesn't run it fails. How can i solve this problem?

Post Reply