• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to access database created with dbforge

#1
Hello!

I'm kinda new with dbforge. I have some questions.

1. If a database is created using dbforge, can you use query builder for the dynamic database(insert, update, delete)?  

2. If you can't use query builder on the dbforge created database, do you just have to build queries with "$this->db->query("YOUR QUERY")"?

3. How do you "select" the dbforge created database to preform queries on? ("$this->db->query('use db2');" so, this is the 'use' statement and it works the same as in SQL syntax?)

Thank you!
Reply

#2
(04-22-2019, 10:23 AM)majortom84 Wrote: 1. If a database is created using dbforge, can you use query builder for the dynamic database(insert, update, delete)?  

In a word, yes.

(04-22-2019, 10:23 AM)majortom84 Wrote: 3. How do you "select" the dbforge created database to preform queries on? ("$this->db->query('use db2');" so, this is the 'use' statement and it works the same as in SQL syntax?)

Consult the documentation on Database Configuration. Down that page a way it describes how you can store multiple sets of connection values. If your dbforge database connection is stored like this

PHP Code:
$db['forged'] = array( 
 
       dsn'   => '',
        '
hostname' => 'localhost',
        etc...
); 

That database could be loaded like this.

PHP Code:
$this->load->database('forged'); 

After which you simply use

PHP Code:
$this->db->query_builder_methods_here(); 

The Connecting to Your Database documentation is helpful too.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.