![]() |
Trying to get values from 2 different tables at same db - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Trying to get values from 2 different tables at same db (/showthread.php?tid=33107) |
Trying to get values from 2 different tables at same db - El Forum - 08-16-2010 [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() Might add that database configurations are correctly entered so basicly problem is in this function. Hopefully its easy to read, thanks Massi Trying to get values from 2 different tables at same db - El Forum - 08-16-2010 [eluser]Jan_1[/eluser] why not join? what do you get on print_r($short); ? Trying to get values from 2 different tables at same db - El Forum - 08-16-2010 [eluser]massi84[/eluser] It gives correct values from $short.. but problem seems to be that it doesnt reconise $data. Even $data = $this->_altdb->like('column', $shorten); gives correct values. if ($data->num_rows()>0) gives fatal error. Trying to get values from 2 different tables at same db - El Forum - 08-16-2010 [eluser]mddd[/eluser] num_rows() must be called on a database result object. $this->db->like() doesn't return a result from the database. You must use $data = $this->db->get('table_name') to get such a result! Trying to get values from 2 different tables at same db - El Forum - 08-16-2010 [eluser]massi84[/eluser] Yeah thanks very much, I got it working. |