Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8824817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:43:44+00:00 2026-06-14T06:43:44+00:00

I just referenced this answer and what I preferred was very first solution, now

  • 0

I just referenced this answer and what I preferred was very first solution, now the issue is he has given an information for mysql_() but am using mysqli_(), so using 4th parameter as true, I select the database when user logs in, the moment he logs in he gets redirected to respective page but it is showing that connection was actively refused. any Idea how I can use 2 database, 1 is my default engine database which I need to keep it on for running my framework and second database to run respective scripts according to the user logged in…

What am trying is this

<?php
    $database_connect = mysqli_connect('localhost', 'root', '', 'engine');
    if(!$database_connect) {
        die ('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
    }

    if(isset($_SESSION['system_id'])) {
        $system_database = mysqli_connect('localhost', 'root', '', $_SESSION['system_name'], true);
        if(!$system_database) {
            die ('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
        }
    }
?>

P.S I want a procedural way

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:43:45+00:00Added an answer on June 14, 2026 at 6:43 am

    You don’t need any extra parameters, simply do it like this

    <?php
        $database_connect = mysqli_connect('localhost', 'root', '', 'engine');
        if(!$database_connect) {
            die ('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
        }
    
        if(isset($_SESSION['system_id'])) {
            $system_database = mysqli_connect('localhost', 'root', '', $_SESSION['system_name']);
            if(!$system_database) {
                die ('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
            }
        }
    
    //Now whatever query you write, just do it like this
    
    $access = mysqli_query($database_connection_var, "/*Query Goes Here*/"); //Will get database name from $database_connection_var
    
    $access2 = mysqli_query($database_connection_var2, "/*Query Goes Here*/"); //Will get database name from $database_connection_var2
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just read this question and the accepted answer: What is JavaScript garbage collection?
I am wondering if the code as referenced as the accepted answer on this
I know it's possible to have lists referenced and show an answer, but is
This question may be very similar to my one, but I cannot see the
I really wanted to figure this out myself, but my face is now hurting
Issue: Just started today, all references to any assembly outside of the solution fail
I'm not interested in call or apply to change the this reference. Just for
I just learned of vim's gf command for navigating to files that are referenced
I just installed the DirectX SDK but when I try to add a reference
I ran into my first compiler that changes the lvalue passed to ::delete, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.