Welcome Guest, Not a member yet? Register   Sign In
Compare two query functions in the controller file
#1

[eluser]masentinel900[/eluser]
Hello guys!!

In my controller I have three vars with querys of differents tables. Like this:

Code:
$data['query'] = $this->content->sectorProy();
  $data['query_A'] = $this->content->itemSecProy();
  $data['query_B'] = $this->content->viewListSector();

That model there are simple "select * from table_name", Now I need in my controller to link the first with the second table and second with the third table. Obviously the structure of the table is linked with a same row in the three tables.

I don't know if this is ok, But I going to give an example about how I would believe.

Code:
$data['query'] = $this->content->sectorProy();
  $data['query_A'] = $this->content->itemSecProy();
   $data['query_B'] = $this->content->viewListSector();
                if($data['query'].name_row = $data['query_A'].name_row_A){
                     foreach($data['query'] ->result_array() as $row){
                                  echo $row['row_name'];
                            }
                     }

Finally I need to do a dependent list of 3 levels which info from 3 differents tables.

For example:
Table 1: Fruits - Colors.
Table 2: Apple, Orange, Banana, Pineapple. - Blue, Red, Purple, Yellow.
Table 3: Seller-Apple, Seller-Orange, Seller-Banana, Seller-Pineapple. - Seller-Blue, Seller-Red. etc.....

Now with that info I need to sort it in a descendent list by levels like this:

Code:
<ul>
       <li>Fruits</li>
             <ul>
                    <li>Orange</li>
                         <ul>
                                <li>Seller-Orange</li>
                        </ul>
             </ul>
             <ul>
                    <li>Apple</li>
             </ul>
             <ul>
                    <li>Pineapple</li>
             </ul>
</ul>

Is some like this. If someone could give me an Idea I going to thanks you so much!!
#2

[eluser]Jan_1[/eluser]
$this->db->join(); ?
Do not really understand what your asking for...




Theme © iAndrew 2016 - Forum software by © MyBB