Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 895

Need Help - I am trying to make multiple database conncetion based on user

by Robotnew - 02 October, 2020 - 06:38 PM
This post is by a banned member (Robotnew) - Unhide
Robotnew  
Infinity
56
Posts
13
Threads
4 Years of service
#1
I want to make a multiple database connection based on new users that register in system. Logic is like this: I have a function that connect with main database below:
function db_connect() {
  static $connection;
  if(!isset($connection)) {
    $connection = mysqli_connect('localhost','main_db_user','main_db_pass','main_db_name');

  if($connection === false){ return mysqli_connect_error(); }
  return $connection;
}
I have created this function inside a file called "conn.php". So, I have created a list with some databases and I want to connect each of them for each new user that is registered in system. In some details: How to change 
the connection(to connect with a new database that I have created before) when a new user is registered in the main database?
This post is by a banned member (ebp) - Unhide
This post is by a banned member (Robotnew) - Unhide
Robotnew  
Infinity
56
Posts
13
Threads
4 Years of service
#3
this is a bump

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)