tags:

views:

324

answers:

1

hi,

i am having the QUery in my controller actions as

   $report_attrid=$this->Report->find('all',array('conditions'=>array('Report.report_id'=>$report_id,'Report.user_id'=>$userId)));

 $submitters['Result']['submitters']=$this->Result->find('all',array('conditions'=>array('Result.form_id'=>$report_form_id)
 ,'group'=>array('Result.submitter_id')));


    foreach($submitters['Result']['submitters'] as $sub)
  {
      echo "Submitter ".$sub['Result']['submitter_id'];
      foreach($report_attrid as & $reportattrid1):

   $submitters['Result']['sub']=$this->Result->find('all',array('conditions'=>array('Result.attribute_id'=>$reportattrid1['Report']['attribute_id'],'Result.submitter_id'=>$sub['Result']['submitter_id'])));

          echo "values ".$submitters['Result']['sub'][0]['Result']['value'];

         endforeach;
  }



      $this->set('submitters',$submitters);

which displays as

   Submitter 1 values NIsha values Below 5 Yrs
   Submitter 6 values Aruna values Above 10 yrs

where $report_attrid is used to retrieve all the reports attribute_id for the selected $report_id which is send through action..

then i am finding the submitters for the Form using $submitters['Result']['submitters'];

Then for each submitter and then foreach attribute_id that i got it from $report_attrid i am finding the values for the corresponding Attribute id and i got the values in $submitters['Result']['sub'];

Everything works correct in Controller side..

But i dont know how to use all these to display the same in the View

i have tried it with

                                <?php echo "submitter id ".$sub['Result']['submitter_id'];?>  
  <?php endforeach; ?>

which displays the submitter id 1 submitter id=6

Please help me to get the values also in the View..

A: 

if in controller you wrote:

$this->set('anything', $a);

in view you should use:

<?php echo $anything;?>
Aziz