Get KoolPHP UI with 30% OFF!

Nested database queries.

Jayme
Hello,
I have the following scenario: One master query without any parameter to pass to and a dependent query which has one parameter which value I should get from the master query.
$mquery = "SELECT * FROM master";
  $stmt = oci_parse($db->MyConn, $mquery );
  if( $stmt ){
    $r = oci_execute($stmt);
    if($r){
	  $query = "SELECT * FROM table where param = :param ";
      $cmd = oci_parse($db->MyConn, $query );
      if($cmd ){
        while( ($row = oci_fetch_array($stmt, OCI_ASSOC)) != false ){
          if(isset($row["MEDICAO"])){
            $mdc = $row["MEDICAO"]+0;
            oci_bind_by_name($cmd,':MEDICAO', $mdc);
            $lck = oci_execute($cmd);
            if($lck){
              while( ($lack = oci_fetch_array($cmd, OCI_ASSOC)) != false ){
                $dataArray[] = array("PONTO"=>$row["IDENTIFICACAO"],"MEDIDOR"=>$row["SERIAL"],"DATA"=>$lack["DATA"],"NUMERO"=>$lack["NUMERO"]);
              }
            }
          }
        }
        oci_free_statement($cmd);
        if(count($dataArray) > 0 ){
          $ds = new ArrayDataSource($dataArray);
		  
		  // KoolGrid definition
		  <cut />
          $kgLckMm->Process();
	      echo $kgLckMm->RenderGrid(); // OR Render() ???
        }
      }
    }
    oci_free_statement($stmt);
  }

Is there a way of refreshing the data from this scenario using KoolGrid::AttachData ? I need to refresh the master query also !
Another option (which I'd rather) could be using AJAX and mount the KoolGrid using another script and paste the result on the main page. Is that possible ?
Best regards.
Jayme Jeffman
Posted Mar 17, 2017 Kool