0

I am facing below problem. Have to fetch a row from database which is not default db. i am querying like ->from("database_name.table_name"), but its been converted as ->from("``database_name``.``table_name``") as gives error. How to correct this please. Thank You!

vikram
  • 189
  • 3
  • 13
  • explore your question. may be you have not load your second database. – NomanJaved Mar 21 '16 at 07:22
  • @NomanJaved You do not need to specifically load another DB if it is on the same server. vikram have a look at http://stackoverflow.com/questions/18080980/how-do-i-ignore-the-backticks-in-codeigniter-when-using-active-records-i-need-t – mic Mar 21 '16 at 08:58

1 Answers1

1

Connect to second database in databse file. Load second database like this.

$DB2=$this->load->database($config, TRUE);    
//then execute the query.

Also follow this link.
Codeigniter - multiple database connections
Hope this will help you.

Community
  • 1
  • 1
NomanJaved
  • 1,324
  • 17
  • 32