will35010 Posted June 18, 2012 Share Posted June 18, 2012 I am working on an application and I wanted it to be a single app with a database for each client. What is the best way to do this? I've tried setting the DB connection using a variable, but it doesn't work. Example: <?php session_start(); $_SESSION['clientid'] = "clientA"; $db = $_SESSION['clientid']; $clientA = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientA'); $clientB = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientB'); $sql = mysqli_query($db, "SELECT * FROM test;"; ?> Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.