php - how to do codeigniter subquery -


how can kind of process in codeignitor

<ul>     <?php     $quer1 = "select id table1"; //conside query examle     foreach ($quer1 $value1) {         ?>         <li>             <?php echo $value1['id']; ?>              <ul>                 <?php                 $quer2 = "select name table2 id = $value1['id']";                 foreach ($quer2 $value2) {                     ?>                 <li><?php echo $value2['name']; ?></li>                   <?php                   }                  ?>             </ul>         </li>         <?php       }     ?> </ul> 

this method ok when doing normal php, because can query , data view, how can controller view

   $this->db->select('id');    $this->db->from('mytable');    $row = $this->db->get()->row();    echo $row['id'];    $this->db->get_where('table2',array('id'=>$row['id'])); 

i hope understand how active record works , if want without active record use following

  $query = "select id mytable";    $this->db->query($query); 

regards


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -