database problem? |
[eluser]Bigil Michael[/eluser]
Hi frnds, i want to know is it possible to use multiple database for the same project???? can any one answer please??????
[eluser]Aken[/eluser]
Yes. http://ellislab.com/codeigniter/user-gui...cting.html
[eluser]Bigil Michael[/eluser]
now i have created 2 databases like this Code: $active_group = "test1"; some tables are in the db city1 remaining in city2 but when i execute my project it shows some tables are missing. can anyone help me???
[eluser]talentsfromindia[/eluser]
You may use as many database as you can for the same project but the point is you need to make a proper connection between the two database which you are using so as to retain all the data without getting the reduct ant one and also without missing the important data by using proper schemas .
[eluser]Bigil Michael[/eluser]
can you point out what is the mistake i made in this code ????
[eluser]InsiteFX[/eluser]
you can only have one active group at a time! Code: $DB1 = $this->load->database('test1', TRUE); CodeIgniter User Guide - Database Connections
[eluser]Bigil Michael[/eluser]
when i use these steps Code: $DB1 = $this->load->database('test1', TRUE); it shows an error Code: Fatal error: Call to a member function where() on a non-object in C:\xampp\htdocs\citimapia\bangalore\system\application\models\home_model.php this is the portion it shows an error Code: $DB1->where('status', '1'); can anyone help me to solve my problem???
[eluser]Bigil Michael[/eluser]
now i print the value like this Code: $DB1 = $this->load->database('test1', TRUE); and the output is DB1: Resource id #44, DB2: Resource id #46 but when i use DB2 in my model it shows an error Quote:Undefined variable: DB2anybody know what is the mistake i made????...
[eluser]InsiteFX[/eluser]
Try Code: $this->db->reconnect();
[eluser]Bigil Michael[/eluser]
now i solved my problem like this Code: class Home_model extends Model { Code: $this->DB1->where('status', '1'); |
Welcome Guest, Not a member yet? Register Sign In |