Welcome Guest, Not a member yet? Register   Sign In
Trying to get values from 2 different tables at same db
#1

[eluser]massi84[/eluser]
Hey, I'm trying to get values from 2 different tables.
Problem here is that I'm getting Fatal error: Call to undefined method CI_DB_mysqli_driver::num_rows() at line :if ($data->num_rows()>0) ...
If someone could point out me to right direction, i would appreciate it.



this is in model:
Code:
function test()
    {
    
    $short = $this->_altdb->get('table1');        
        
            
if ($short->num_rows()>0)
{                
    $i=0;
    foreach ($short->result() as $row)
    {
        $shorten = $row->column1;    
                    
        $data = $this->_altdb->like('column', $shorten);        

        if ($data->num_rows()>0)
        {        
            foreach ($data->result() as $row)
            {                
                          $name=$row->column2; // column 2 from                            table2                

// here need to put values at same variable $all_data

              $all_data[$i]['column1'] = $shorten;
              $all_data[$i]['column2'] = $name;
            }
        }
        $i++;
    }
   }                    
    
}

Might add that database configurations are correctly entered so basicly problem is in this function.

Hopefully its easy to read, thanks
Massi


Messages In This Thread
Trying to get values from 2 different tables at same db - by El Forum - 08-16-2010, 03:04 AM
Trying to get values from 2 different tables at same db - by El Forum - 08-16-2010, 03:19 AM
Trying to get values from 2 different tables at same db - by El Forum - 08-16-2010, 03:47 AM
Trying to get values from 2 different tables at same db - by El Forum - 08-16-2010, 04:02 AM
Trying to get values from 2 different tables at same db - by El Forum - 08-16-2010, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB