Hello,
I am trying to change MySQL database connection.
Primary I have database: my_default_db
I want to set new database for each customer separately.
I tried many things, but not succedded.
I stored all data of all customers in one database, named: all_clients where I have all data of separated database.
Here is the code which I tried to implement:
$check_sql = “SELECT drive, server, user, password, database, persistent, encoding”
. " FROM PT_Narocniki_firma"
. " WHERE Naziv = ‘" . {Podjetje} . "’";
sc_lookup(rs, $check_sql);
$drive = {rs[0][0]};
$server = {rs[0][1]};
$user = {rs[0][2]};
$password = {rs[0][3]};
$database = {rs[0][4]};
$persistent = {rs[0][5]};
$encoding = {rs[0][6]};
$arr_conn = array();
$arr_conn[‘drive’] = $drive;
$arr_conn[‘server’] = $server;
$arr_conn[‘user’] = $user;
$arr_conn[‘password’] = $password;
$arr_conn[‘database’] = $database;
$arr_conn[‘persistent’] = $persistent;
$arr_conn[‘encoding’] = $encoding;
sc_connection_edit(“DATABASE”, $arr_conn);
After this connection DATABASE is still connected to “my_default_db”. It doesn’t change to $database. Why?
Thank you for your answers!