Welcome Guest, Not a member yet? Register   Sign In
Loading database kills my code
#2

[eluser]chejnik[/eluser]
Hello, have a look in config directory and see the database.php
There you store your database settings.

Then have a look into autoload.php in the same directory and add database to array of libraries
that will load in the beginning ( so you dont have to care about loading db).

Then call from controller view a model like this

Code:
function updateWord()
    {
        $this->load->model('Settings_model');
        
        $structure = $this->Settings_model->selectStructure($this->session->userdata('i'));

    }

And in model named settings_model.php this function in model directory

Code:
function selectStructure($i)
    {
      $tableSettings ='databaseSettings'.$i;  

        $this->db->select('databaseRowName');
    $this->db->from($tableSettings);
    $query = $this->db->get();
      return $query->result_array();
    }
Hope that helps little bit. Ales


Messages In This Thread
Loading database kills my code - by El Forum - 02-23-2008, 11:38 AM
Loading database kills my code - by El Forum - 02-23-2008, 12:00 PM
Loading database kills my code - by El Forum - 04-14-2008, 07:20 AM
Loading database kills my code - by El Forum - 04-14-2008, 09:12 AM
Loading database kills my code - by El Forum - 04-14-2008, 09:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB