Announcement

Collapse
No announcement yet.

Issue with ADO in Libraries

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with ADO in Libraries

    I have a form calling a lib. In this lib I try to select some data and return an array of string:

    Code:
    if($tran=='') {
      $check_sql = "SELECT shopid, origin, customerid, invoiceid, invoicedate, amountwotax, amounttax, amountincltax, ".
    	           "paymentstatus, paymentdate, paymentmethod, paymenturl, invoicestatus, invoicelinktype, invoicelink, ".
    	           "PaypalTran, IdealTran, customeremail, customerlogincode FROM ndelectroniccollection WHERE ".
                    "shopid='".$shopid."' AND customerlogincode='".$token."'";
    } else {
    	$check_sql = "SELECT shopid, origin, customerid, invoiceid, invoicedate, amountwotax, amounttax, amountincltax, ".
    	           "paymentstatus, paymentdate, paymentmethod, paymenturl, invoicestatus, invoicelinktype, invoicelink, ".
    	           "PaypalTran, IdealTran, customeremail, customerlogincode FROM ndelectroniccollection WHERE ".
                    "shopid='".$shopid."' AND customerlogincode='".$token."' AND IdealTran='".$tran."'";
    }
    	
    sc_select(rsx, $check_sql);	
    	
    	var_dump($rsx);
    		     
    if (isset({rsx[0][0]}))     // Row found
    {
        $rpl['shop_id']=$rsx->fields[0];
        $rpl['giro_id']=$rsx->fields[3];	
        $rpl['bedrag_incl']=$rsx->fields[7];	
        $rpl['bedrag_excl']=$rsx->fields[5];	
        $rpl['perc_btw']=$rsx->fields[6].'%';
        $rpl['emailto']=$rsx->fields[17];	
    } else {
        $rpl['shop_id']='&nbsp';
        $rpl['giro_id']='&nbsp';
        $rpl['bedrag_incl']='&nbsp';
        $rpl['bedrag_excl']='&nbsp';
        $rpl['perc_btw']='&nbsp';
        $rpl['emailto']='&nbsp';
    }
    
    	$rpl['datum']=$date = date('d-m-Y', time());
    	$rpl['tijd']=date('h:i:s a', time());
    	
    	return $rpl;
    }
    ?>
    If I run this code I get a strange errormessage:

    Fatal error: Cannot use object of type ADORecordSet_mysqlt as array in C:\Program Files (x86)\NetMake\v7\wwwroot\scriptcase\app\nowdue\gri d_ndelectronicgiro_list\index.php on line 2029

    The generated code is very obvious:

    Code:
         var_dump($this->rsx);
    2024|              
    2025| if (isset($this->rsx[0][0]))     
    2026| {
    2027|     $rpl['shop_id']=$this->rsx->fields[0];
    2028|     $rpl['giro_id']=$this->rsx->fields[3];    
    2029|     $rpl['bedrag_incl']=$this->rsx->fields[7];    
    2030|     $rpl['bedrag_excl']=$this->rsx->fields[5];    
    2031|     $rpl['perc_btw']=$this->rsx->fields[6].'%';
    2032|     $rpl['emailto']=$this->rsx->fields[17];    
    2033| } else {
    2034|     $rpl['shop_id']='&nbsp';
    2035|     $rpl['giro_id']='&nbsp';
    2036|     $rpl['bedrag_incl']='&nbsp';
    2037|     $rpl['bedrag_excl']='&nbsp';
    2038|     $rpl['perc_btw']='&nbsp';
    2039|     $rpl['emailto']='&nbsp';
    2040| }
    The vardump shows that the data is availalbe:

    Code:
    object(ADORecordSet_mysqlt)#15 (29) { ["databaseType"]=> string(6) "mysqlt" ["canSeek"]=> bool(true) ["dataProvider"]=> string(6) "native" ["fields"]=> array(38) { [0]=> string(6) "aducom" ["shopid"]=> string(6) "aducom" [1]=> string(4) "EOLA" ["origin"]=> string(4) "EOLA" [2]=> string(1) "0" ["customerid"]=> string(1) "0" [3]=> string(1) "3" ["invoiceid"]=> string(1) "3" [4]=> string(19) "2014-07-05 12:29:57" ["invoicedate"]=> string(19) "2014-07-05 12:29:57" [5]=> string(4) "1.00" ["amountwotax"]=> string(4) "1.00" [6]=> string(5) "21.00" ["amounttax"]=> string(5) "21.00" [7]=> string(4) "1.21" ["amountincltax"]=> string(4) "1.21" [8]=> string(0) "" ["paymentstatus"]=> string(0) "" [9]=> NULL ["paymentdate"]=> NULL [10]=> NULL ["paymentmethod"]=> NULL [11]=> NULL ["paymenturl"]=> NULL [12]=> string(2) "OP" ["invoicestatus"]=> string(2) "OP" [13]=> NULL ["invoicelinktype"]=> NULL [14]=> NULL ["invoicelink"]=> NULL [15]=> string(1) "0" ["PaypalTran"]=> string(1) "0" [16]=> string(1) "0" ["IdealTran"]=> string(1) "0" [17]=> string(18) "a.drent@aducom.com" ["customeremail"]=> string(18) "a.drent@aducom.com" [18]=> string(72) "8ED83EE0-C135-B193-72F9-A4ACD8F8E9C585F59850-71AE-46C1-90C0-5ADD22F77DD6" ["customerlogincode"]=> string(72) "8ED83EE0-C135-B193-72F9-A4ACD8F8E9C585F59850-71AE-46C1-90C0-5ADD22F77DD6" } ["blobSize"]=> int(100) ["sql"]=> string(400)
    It goes wrong on $this->rsx->fields[7]; which is a money field.

    [5]=> string(4) "1.00" ["amountwotax"]=> string(4) "1.00" [6]=> string(5) "21.00" ["amounttax"]=> string(5) "21.00" [7]=> string(4) "1.21" ["amountincltax"]=> string(4) "1.21"


    Then I changed the code to:

    Code:
    		     
    if (isset({rsx[0][0]}))     // Row found
    {
        $rpl['shop_id']={rsx[0][0]};
        $rpl['giro_id']={rsx[0][3]};
        $rpl['bedrag_incl']={rsx[0][7]};
        $rpl['bedrag_excl']={rsx[0][5]};
        $rpl['perc_btw']={rsx[0][6]}.'%';
        $rpl['emailto']={rsx[0][17]};
    } else {
        $rpl['shop_id']='&nbsp';
        $rpl['giro_id']='&nbsp';
        $rpl['bedrag_incl']='&nbsp';
        $rpl['bedrag_excl']='&nbsp';
        $rpl['perc_btw']='&nbsp';
        $rpl['emailto']='&nbsp';
    }
    But the same error occurs.

    Now I moved the else section up to:

    Code:
    		     
        $rpl['shop_id']='&nbsp';
        $rpl['giro_id']='&nbsp';
        $rpl['bedrag_incl']='&nbsp';
        $rpl['bedrag_excl']='&nbsp';
        $rpl['perc_btw']='&nbsp';
        $rpl['emailto']='&nbsp';
    
    if (isset({rsx[0][0]}))     // Row found
    {
        $rpl['shop_id']={rsx[0][0]};
        $rpl['giro_id']={rsx[0][3]};
        $rpl['bedrag_incl']={rsx[0][7]};
        $rpl['bedrag_excl']={rsx[0][5]};
        $rpl['perc_btw']={rsx[0][6]}.'%';
        $rpl['emailto']={rsx[0][17]};
    }

    It works now. What's going on here? This has nothing to do with ADO...
    Last edited by aducom; 07-05-2014, 08:00 AM.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

  • #2
    Hi Albert,
    Just a far fetched idea, BUT could the "incl" in the array key be causing an issue? I wonder if it could somehow be causing some confusion with the PHP keyword include? Can you test without that part of the string?
    Peace,
    Jamie

    Comment


    • #3
      Hi Jamie,

      Could be. I'll try to test it in some demo app. My wild guess is that there's a problem with the scriptcase php parser. If you have brackets between comments it also goes wrong and there are some other issues.

      albert
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment

      Working...
      X