multiple database connection (codeigniter 2.0.3)

#1
[eluser]Unknown[/eluser]
Ok so I have followed the user manual as best I can and had a look around the forums but still can't seem to solve this problem.

database.php

Code:
$active_group = 'site';
$active_record = TRUE;


$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'pass';
$db['default']['database'] = 'bombard1';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;


$active_group = 'mail';
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'pass';
$db['default']['database'] = 'rnd1';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;


autoload does not include 'database'

model for add user

Code:
function create_user()
{ $DBS = $this->load->database('site', TRUE);
  $DBM = $this->load->database('mail', TRUE);
  $password= $this->membership_model->random_string(10);

  $new_user_insert_data = array(
   'f_name' => $this->input->post('f_name'),
   'l_name' => $this->input->post('l_name'),
   'email' => $this->input->post('email'),
   'rc_email' => $this->input->post('rc_email'),  
   'username' => $this->input->post('username'),
   'password' => sha1($password)      
  );
  
  $insert = $this->DBS->insert('users', $new_user_insert_data);
  
  $userUID=$this->DBS->insert_id();
  
  $new_user_roles = array(
   'userID' => $userUID,
   'roleID' => '1',
   'addDate' => date ("Y-m-d H:i:s")  
  );

  $insert = $this->DBS->insert('user_roles', $new_user_roles);

  $new_mailuser_insert_data = array(
   'username' => $this->input->post('rc_email'),
   'mail_host' => 'localhost',
   'created' => date("Y-m-d H:i:s"),
   'language' =>'en_GB'  
  );


  $insert = $this->DBM->insert('users', $new_mailuser_insert_data);
  
  $userRcID =$this->DBM->insert_id();

  $new_mailident_insert_data = array(
     'user_id'=> $userRcID,
     'changed'=> date("Y-m-d H:i:s"),
     'standard'=> '1',
     'name' =>$name,
     'organization' => 'Bombardier',
     'email' =>$this->input->post('rc_email')
     );


  $insert = $this->DBM->insert('identities', $new_mailident_insert_data);
  
  
  
    return $insert;
   }

(I know its messy I haven't done my housework yet Smile ...)


I am at a loss and could really do with some help here. The worst part is to follow this I have to do a cpanel hack to add an email account mmmmm fun.




Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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