Welcome Guest, Not a member yet? Register   Sign In
Query multiple databases from a model class
#1

[eluser]Pokhara[/eluser]
Hi friends I have a form that query multiple databases. How do I write a query in such cases in CI ? please help me if possible with code example. Thanks
#2

[eluser]ram4nd[/eluser]
Here you go, a nice tutorial about it: Multiple Database Support
#3

[eluser]Pokhara[/eluser]
my bad, sorry ... I meant multiple table not databases.Thanks
#4

[eluser]umefarooq[/eluser]
yes you can query multiple table with model, this up to you how you design your model, you can get records with join two tables, you want to use same model for different tables in you database here is little example

Code:
class core_model extend Model{
  function core_model(){
        parent::Model();
   }
   function get_rows($table=''){
      return $this->db->get($table)->result();
   }
  }

in controller call you model

$this->core_model->get_rows('your_any_table_name');




Theme © iAndrew 2016 - Forum software by © MyBB