Welcome Guest, Not a member yet? Register   Sign In
wanwizard, datamapper. session wont store data in default database if use cart library

I using multiple database connection in my program, with cart library cart is loaded. when I inserting data to cart..it saved to my other database, not my default database..


What has Datamapper to do with either a Session or a Cart library?

The cart library (I assume CI's own library?) only uses sessions, so if that doesn't work, debug that. My guess: you're using cookies to store session data, and your cart data exceeds the 4Kb limit of a cookie.

Saving cart data to the database is something you have to code up, so without showing us how you've done that, we can keep on guessing...

I using CI's sessions with database..
I have two database connection.
here is my db group in my database.php file :
$active_group = 'mahasiswa';
$active_record = TRUE;
$db['mahasiswa']['hostname'] = 'localhost';
$db['mahasiswa']['username'] = 'aplikasi';
$db['mahasiswa']['password'] = '123456';
$db['mahasiswa']['database'] = 'mahasiswa';
$db['mahasiswa']['dbdriver'] = 'mysql';
$db['mahasiswa']['dbprefix'] = '';
$db['mahasiswa']['pconnect'] = TRUE;
$db['mahasiswa']['db_debug'] = TRUE;
$db['mahasiswa']['cache_on'] = FALSE;
$db['mahasiswa']['cachedir'] = '';
$db['mahasiswa']['char_set'] = 'utf8';
$db['mahasiswa']['dbcollat'] = 'utf8_general_ci';
$db['mahasiswa']['swap_pre'] = '';
$db['mahasiswa']['autoinit'] = TRUE;
$db['mahasiswa']['stricton'] = FALSE;

$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'aplikasi';
$db['default']['password'] = '123456';
$db['default']['database'] = 'transkrip';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$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;
when I submit with
my data stored to "mahasiswa.ci_sessions" instead of my default connection..
and I got an error, because there's no ci_sessions table in mahasiswa

and here's my model
Class Mahasiswa_Model extends DataMapper{
     var $db_params = 'mahasiswa';
     var $table = "mahasiswa";

Your database config file defines $active_group twice, the second one overwriting the first. So this config file defines 'default' as your default database...

so, what I supposed to do with my config ?
is there any other way to solve this problem ?
I just want to insert cart data into db default.ci_sessions..

Theme © iAndrew 2016 - Forum software by © MyBB